本文介绍了mysqldump生成0kb的sql文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用mysqldump进行mySQL数据库的备份和恢复.我的代码生成一个sql文件,但它为空.这是我完整的代码.非常感谢.
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.";
?>
推荐答案
您使用了-p
选项,该选项告诉mysqldump
要求您输入密码-当然,这仅在交互式shell中有效.您将必须直接指定密码:
You used the option -p
which tells mysqldump
to ask you for a password – which of course only works in an interactive shell. You will have to specify your password directly:
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");
这篇关于mysqldump生成0kb的sql文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!