简体   繁体   English

使用mysqldump进行mysql数据库备份

[英]mysql database backup with mysqldump

I want to backup my database using mysql dump. 我想使用mysql dump备份我的数据库。 This is the code I run in Command prompt when the location is mysql bin. 这是我在命令提示符下运行的代码,当位置是mysql bin时。
mysqldump -u root -pabc Db -r C:\\Documents and Settings\\All Users\\Desktop\\ttttt.sql
abc is the password. abc是密码。 and I try to backup to a .sql file in desktop. 我尝试备份到桌面上的.sql文件。 I use mysql 5.5. 我使用mysql 5.5。
But the following error occured. 但发生以下错误。 mysqldump: Couldn't find table: "and"
But there is no table called 'and' in database and I didn't create such a table.But the error say about a 'and' table. 但是在数据库中没有名为'and'的表,我没有创建这样的表。但错误说的是'和'表。 How can I back up mysql database without this error. 如何在没有此错误的情况下备份mysql数据库。

Try instead: 尝试改为:

mysqldump -u root -pabc Db -r "C:\Documents and Settings\All Users\Desktop\ttttt.sql"

Your command shell is breaking apart the pathname into multiple arguments. 您的命令shell将路径名拆分为多个参数。 The quotes tell the shell to pass it all as a single argument to the mysqldump program. 引号告诉shell将它作为mysqldump程序的单个参数传递给它。

I think there is some problem with syntax of command you are running. 我认为你正在运行的命令语法存在一些问题。 try something like this : 尝试这样的事情:

mysqldump -u root -p dbName > path\nameOfFile.sql

It will automatically ask for your password. 它会自动询问您的密码。 You don't need to write it in command. 您不需要在命令中编写它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM