MySQL 尝试执行 mysqldump 命令时出现错误 1064(42000)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19281026/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
error 1064(42000) while trying to execute mysqldump command
提问by user2864433
im trying to run the following command: mysql> mysqldump --all-databases > dump.sql;on my local(On my pc) Mysql 5.5 server but I keep getting this error:
我试图运行以下命令: mysql> mysqldump --all-databases > dump.sql; 在我的本地(在我的电脑上)Mysql 5.5 服务器上,但我不断收到此错误:
mysql> mysqldump --all-databases > dump.sql;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'mysql
dump --all-databases > dump.sql' at line 1.
回答by Bill Karwin
mysqldump is a command you invoke at the shell prompt, not within the mysql client environment.
mysqldump 是您在 shell 提示符下调用的命令,而不是在 mysql 客户端环境中调用。
mysql> exit
$ mysqldump --all-databases > dump.sql
回答by matteospampani
You must execute that command from the system shell, don't forget to use username and password to access all databases, example:
您必须从系统 shell 执行该命令,不要忘记使用用户名和密码访问所有数据库,例如:
mysqldump -u root -p --all-databases > dump.sql