Reputation: 1669
I'm trying to generate a mysql dump file from PHP using the following:
exec('mysqldump -u root -ppassword maindb > c:\DB_Dump.sql');
However the file being generated is blank. Anyone knows what's wrong?
From the cmd, this is working:
cd C:\Program Files\MySQL\MySQL Server 5.5\bin
to change the path and then
mysqldump -u root -ppassword maindb > c:\DB_Dump.sql
But I'm trying to do it within PHP.
Upvotes: 0
Views: 278
Reputation: 146660
To discard most common issues:
The path to mysqldump in your computer appears to have white spaces. Make sure you quote it properly:
exec('"C:\\Program Files\\MySQL\\MySQL Server 5.5\\bin\\mysqldump" -u root -ppassword maindb > c:\\DB_Dump.sql 2> c:\file.err.txt')
Upvotes: 2