Jonathan Stellwag Jonathan Stellwag - 1 month ago 14
PHP Question

MySqlDump - Empty dump by using Windows

Tried out the mysqldump exe to get a local dump. Worked fine on MAC_OS. Just at windows i get a exit-code 1 and a local empty .sql file.

I used following code:

$command = ''.$locationDumpExe.' --user='.$dbuser.' --password='.$dbpassword.' --no-data --host=localhost '.$dbname.' > '.$dumpfile.'';


The variables had been set like the following:

  • $locationDumpExe = "/xampp/mysql/bin";

  • $dbuser = "root";

  • $dbpassword = "";

  • $dbname = "test_db";

  • $dumpfile = "testdump.sql"

The return_var returns 1

The test_db has an amount of 90 - 100 tables and is filled with ~ 50 - 100 datasets. Maybe this is the issue?

As I said on Mac_OS the dump works fine but for good reasons I also have to use the dump functionality on Windows.

Thanks in advance for your help.


when you try with windows you have to specify the full path of mysqldump.exe

C:/wamp/bin/mysql/mysql5.6.17/bin/mysqldump.exe -h {hostname} -u {usernamne} -p{password} {dbName} > path/to/store/sql/file.

Hope this helps. Thanks Suman W.