Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySqlDump - Empty dump by using Windows

Tags:

php

mysql

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.'';

exec($command,$output,$return_var);

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.

like image 822
Jonathan Stellwag Avatar asked Sep 15 '25 05:09

Jonathan Stellwag


1 Answers

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.

like image 96
Suman EStatic Avatar answered Sep 16 '25 19:09

Suman EStatic