ashii Posted July 6, 2012 Share Posted July 6, 2012 I am sorry if someone else has come up with this topic earlier. (please let me know if that was solved) I want to take a backup of my mysql db using php, and I went searching for some solutions in google, but yet I couldn't find a right one, so could anyone post me the code or the link which really works for you! thank you. Quote Link to comment Share on other sites More sharing options...
xyph Posted July 6, 2012 Share Posted July 6, 2012 Did you want it done at a certain interval, or manually? Quote Link to comment Share on other sites More sharing options...
ashii Posted July 6, 2012 Author Share Posted July 6, 2012 I need it to be done manually thank you. Quote Link to comment Share on other sites More sharing options...
trq Posted July 6, 2012 Share Posted July 6, 2012 Is there a particular reason you need php to do this? It can be done simply enough from the command line. mysqldump nameofdb | gzip > nameofdb.bkp.sql.gz If you need it to be done via php you can use exec to execute this same command. Quote Link to comment Share on other sites More sharing options...
ashii Posted July 6, 2012 Author Share Posted July 6, 2012 Thank you for the reply, I wrote the code and it throws me an error saying "mysqldump is not recognized as an internal or external command, operable program or batch file." The reason is I am going to port this code into my drupal module. Thank you. Quote Link to comment Share on other sites More sharing options...
trq Posted July 6, 2012 Share Posted July 6, 2012 You might need to supply the full path to mysqldump. eg; /usr/local/bin/mysqldump nameofdb | gzip > nameofdb.bkp.sql.gz You will likely also need to pass it a user and password. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.