I need to get a DBDUMP, i am using MySQL. I get the following error when i try to get a DB Dump. Any clue what it did wrong.
C:\Program Files\MySQL\MySQL Server 5.1\bin>mysqldump -u root -p xxx myDB
e > dump.sql
Enter password: ***
mysqldump: Got error: 1049: Unknown database 'xxx' when selecting the database
That command is saying you want to enter the password at the prompt and dump the myDB
table from the xxx
database. If you get rid of the "xxx" part and enter the password at the prompt, it should work.
If you actually want to specify the password on the command line, you have to do -pWHATEVER
(where "WHATEVER" is the literal password, with no space after the switch), or --password=WHATEVER
, but:
Specifying a password on the command line should be considered insecure.
you should delete the xxx behind the -p , because the is type int the next line at the Enter password, and you should write your database name.
If you want to avoid warning "Specifying a password on the command line should be considered insecure." just use option --defaults-extra-file
For example:
/usr/bin/mysqldump --defaults-extra-file=/tmp/auth.tmp --user=xxx --tables dbname --host localhost
Where /tmp/auth.tmp content is
[client]
password=yyyy
If you use localhost with basic user=root,password=<blank>
just copy this mysqldump -d -u root -l dbname
来源:https://stackoverflow.com/questions/11811029/mysql-dbdump-error-message