开发者

mysql dump error

开发者 https://www.devze.com 2023-03-31 11:55 出处:网络
I\'m having some difficulty with mysqldump.I locked my tables and ran the following command: mysqldump -u user -p password databasename using my actual password and database name.

I'm having some difficulty with mysqldump. I locked my tables and ran the following command:

mysqldump -u user -p password databasename using my actual password and database name.

When I run this from mysql I get a 1064 error 开发者_JAVA百科that says there is an issue with my syntax. I've also tried running the command from terminal (outside of mysql) and receive a 'command not found' error message. I'm not entirely sure how I should be doing this (the explanations I've found so far have been vague).

Thanks for the help.


  1. The mysqldump is a program, it cannot be executed from the mysql console. Run it from the shell.

  2. Have a look at the syntax reference.

    --user=user_name, -u user_name

    --password[=password], -p[password]

As you see there is no space between -p and password. So, your command line should be like this:

>shell mysqldump -u <user_name> -p<user_password> ...

or

>shell mysqldump --user=<user_name> --password=<user_password> ...


You are missing the target backup file name:

# [mysql dir]/bin/mysqldump -u username -p password --databases databasename > /tmp/databasename.sql
  • MySQL Commands


the correct syntax is

mysqldump -u [username] -p[password] [databasename] > [backupfile.sql]

you should add the > backupfile.sql

the other error is believe your system doesn't recognize the mysqldump path and you should go directly to bin folder from mysql installation.

0

精彩评论

暂无评论...
验证码 换一张
取 消