0

I'm trying to export and import database in lighttpd using php. Mysqldump does not work as is:

$command= 'mysqldump -h localhost -u root -pXXXX db_name > backup.sql';
exec($command);
aurelius
  • 3,946
  • 7
  • 40
  • 73
  • 1
    Is a mysql client installed on the machine you are running this command from? What is the output of exec? – hofan41 Dec 23 '14 at 08:39
  • the sql file is blank, i was looking for mysqldump exc file in lighttpd directories but have yet to find it – Noah M Lively Dec 23 '14 at 08:53
  • its installed on a minix mini device through the palapa webserver – Noah M Lively Dec 23 '14 at 08:54
  • I meant what is the output of the exec function call, not your command. http://php.net/manual/en/function.exec.php The output of the actual exec function should contain an error message for what is wrong. – hofan41 Dec 23 '14 at 19:42

2 Answers2

0

If you want to download it from browser just use passthru

passthru('mysqldump -h localhost -u root -pXXXX db_name');
Shiplu Mokaddim
  • 56,364
  • 17
  • 141
  • 187
0

I was using Palapa Webserver and it turns out the mysqldump application is not included. Sorry, should have checked this first and I also should have been clear that I was using Palapa Webserver.

I just ended up using import and export functions that I found.

Import:

how to import .sql file in mysql database using php

Export:

http://davidwalsh.name/backup-mysql-database-php

Thanks

Community
  • 1
  • 1