PHP, MySQL restore spaces in dir/file names

brendon2020

[H]ard|Gawd
Joined
Dec 15, 2002
Messages
1,541
When restoring tables/db's thru mysql/mysql.exe what is the correct way to restore the table/db when the sql/backup file has spaces in the filename and/or spaces in the directory name? So,
Code:
/usr/bin/mysql --user="user" --pass="pass" < "/home/user/some folder/some backup file.sql"

-bash: /home/user/some folder/some backup file.sql: No such file or directory

BTW this is actually for a windows 2k server and i'm working on a ubuntu box, so i'd like is if i can make sure that the dir and filename will work with mysql.exe. TIA
 
Try using "%20" (no quotes) instead of spaces. I don't know that it will work, but it might.

good%20luck :p
 
i just installed some mysql binaries on my workstation (xp) and so far it works fine on windows (dir and filenames with spaces). I'll worry about it later for linux.
 
i posted this on serveral forums and geoff2k from EXTREME Overclocking Forums gave this solution which works perfectly on windows and linux
linux:
Code:
cat "/home/user/some folder/some backup file.sql" | /usr/bin/mysql --user="user" --pass="pass"
Windows:
Code:
type "/home/user/some folder/some backup file.sql" | mysql.exe --user="user" --pass="pass"
 
Back
Top