Code: Select all
exec($MYSQL_BIN_DIR.'mysqldump.exe --user='.$MYSQL_USER.' --password='.$MYSQL_PASS.' '.$db['Database'].' > "'.$BackupDir.'build\\SQL\\'.$db['Database'].'.sql"');
//echoed its this:
// C:\MySQL\bin\mysqldump.exe --user=root --password=stuff123 testing > "C:\_Backups\build\SQL\testing.sql"
exec('"'.$MYSQL_BIN_DIR.'mysqldump.exe" --user='.$MYSQL_USER.' --password='.$MYSQL_PASS.' '.$db['Database'].' > "'.$BackupDir.'build\\SQL\\'.$db['Database'].'.sql"');
//echoed its this:
// "C:\MySQL\bin\mysqldump.exe" --user=root --password=stuff123 testing > "C:\_Backups\build\SQL\testing.sql"The second one doesn't work in PHP but when I copy the echoed output and paste it into the server's CMD window it works.
I am trying to put quotes around the paths since if there is a space in the path to the MySQL directory the command will fail.
Assuming $MYSQL_BIN_DIR is something like C:\Program Files\MySQL\bin\