Sunday, 15 May 2011

MySQL dump on WAMP server using PHP -


I am trying to dump mysql database using a PHP file. I'm using Windows 7 OS.

But I always get an error; This is my code

  $ user = 'root'; $ = 'Mypassword' passed; $ Host = 'localhost'; //$sql_file='db_backup.sql '; $ CMD = "E: \\ wamp \\ bin \\ mysql \\ mysql5.6.12 \\ bin \\ mysqldump -h $ host -u $ user -p $ exits hospital gt; db_backup.sql"; Exec ($ CMD, $ output, $ return); If ($ return! = 0) {// 0 OK is dead ('error:'. Implode ("\ r \ n", $ output)); } Echo "full dump";  

Any suggestions would be greatly appreciated. Thank you.

OK I have got the solution, anyone can find it useful.

  user $ = 'root'; $ = 'Mypassword' passed; $ Host = 'localhost'; $ CMD = 'E: \ wamp \ bin \ mysql \ mysql5.6.12 \ bin \ mysqldump --user =' $ User '--password =' $ Pass. ' --host = Localhost Hospital & gt; Db_backup4.sql '; // var_dump ($ cmd); Exit; Exec ($ CMD, $ output, $ return); If ($ return! = 0) {// 0 OK is dead ('error:'. Implode ("\ r \ n", $ output)); } Echo "full dump";  

No comments:

Post a Comment