dumping DB in mysql

北慕城南 提交于 2019-12-23 04:56:51

问题


when I run below statement, mysql is complaining having error.

mysqldump --triggers --routines -u root -p mydb > mydb_20120924.dmp;

mysql version: 5.1.34

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 --triggers --routines -u root -p mydb > mydb_20120924.dmp' at line 1


回答1:


It looks like you are trying to run the mysqldump command from inside the mysql command line interpreter.

Does the prompt for the mysqldump command say 'mysql> '? Then you are running the mysql command line interpreter. It should be used - indeed, it can only be used - for running mysql commands.

mysqldump is a separate command and must be run from the shell.

Quit mysql by typing "exit" - you will see a shell prompt. Then the mysqldump command will work.




回答2:


If you have a database called "mydb" this should work. You could try using --database specifically:

mysqldump --triggers --routines -u root -p --database mydb > mydb_20120924.dmp;



来源:https://stackoverflow.com/questions/12560362/dumping-db-in-mysql

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