谁能告诉我为什么会出现这个错误
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 'mysqldump -p --user=root database_name utilities > utilities.sql'
在此 mysqldump -p --user=root database_name utilities > utilities.sql;
我尝试将数据库名称、表名称保留在反引号中。似乎没有任何效果。
最佳答案
mysqldump应该从 而不是 mysql
命令的普通命令提示符/shell 运行,而不是在其中的 mysql 提示符下运行。
ubuntu-vm:~$ mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 38
Server version: 5.5.31-0ubuntu0.13.04.1 (Ubuntu)
mysql> exit
Bye
ubuntu-vm:~$ mysqldump -help
Usage: mysqldump [OPTIONS] database [tables]
OR mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]
OR mysqldump [OPTIONS] --all-databases [OPTIONS]
For more options, use mysqldump --help
ic@ubuntu-vm:~$
关于从数据库导出表时出现 mysqldump 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16785342/