mysqldump generates 0kb sql file

匿名 (未验证) 提交于 2019-12-03 01:36:02

问题:

I am working on backup and recovery of mySQL database using mysqldump. My code generates an sql file but its empty. Here's my complete code. Thanks a lot.

<?    shell_exec("mysqldump -u root -p ilamdb > db/ilamdb.sql");    echo "Back up complete."; ?> 

回答1:

You used the option -p which tells mysqldump

shell_exec("mysqldump -u root --password=yourpassword ilamdb > db/ilamdb.sql"); 

If you don't use a password, simply leave out this parameter:

shell_exec("mysqldump -u root ilamdb > db/ilamdb.sql"); 


回答2:

MySQL backup syntax should be as below

mysqldump -u --password= >File.dmp



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!