niche Posted October 18, 2013 Share Posted October 18, 2013 (edited) I'd like to get away from manual bu with phpmyadmin. mysqldump looks like the answer, but my output is empty and there's no errors. My db doesn't have a pw. Here's my code: shell_exec("mysqldump armor '' emily alpha,catkey > e:/sql/alpha2.sql"); What do you think the problem is? Edited October 19, 2013 by niche Link to comment Share on other sites More sharing options...
Lulzim Posted October 18, 2013 Share Posted October 18, 2013 (edited) even though your user has no password you have to specify the user. mysqldump -u root database_name > e:/sql/alpha2.sql try running the command on command line first to see if you get the desired result and then put int on php script and if you are on windows, you might have to include the full path to mysqldump (something like "c:program filesmysqlbinmysqldump.exe -u root database_name > e:/sql/alpha2.sql") Edited October 18, 2013 by Lulzim 1 Link to comment Share on other sites More sharing options...
niche Posted October 18, 2013 Author Share Posted October 18, 2013 This works from the command line: e:wampbinmysqlmysql5.1.33binmysqldump -h localhost -u armor -p emily alpha> e:sqlalpha4.sqlHow do I run this from php without being promped for a pw? I thought I could use shell_exec(), but no joy. Link to comment Share on other sites More sharing options...
niche Posted October 19, 2013 Author Share Posted October 19, 2013 (edited) Solved. shell_exec("wampbinmysqlmysql5.1.33binmysqldump -h localhost -u armor emily alpha> e:sqlalpha5.sql"); Was missing the path for mysqldump. Never used shell_exec() before. I didn't expect the path to be relevant. lulzim's tip led to the solution. Thanks for your help lulzim. Edited October 19, 2013 by niche Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now