mysql dump generating a blank sql file
Please help, I got this code from googling on how to use mysql dump on php. But its just generating a blank .sql file. I already tried putting the mysqldump.exe on the same directory as the php file but doesn't work.
<?php
system('mysqldump -uroot -pmypassword test > C:\wamp\www\test\test.sql');
?>
I'm trying to do this, but I am running windows 7 and 开发者_高级运维I get access denied error if I change the privileges in cmd.exe even if I'm the admin.
Please help, why is it generating a blank sql file? How do I solve this?
Try putting a space between the -u and your username
<?php
system('mysqldump -u root -pmypassword test > C:\wamp\www\test\test.sql');
?>
You should check the return value from the "system" operation. You should check your file path. You should check the database exists.
A good way to verify all that is to execute this command by hand, before using it in php.
精彩评论