简体   繁体   中英

Getting warning ignoring option '--databases' due to invalid value 'testdatabase' in mysql while importing data

i am getting warning ignoring option '--databases' due to invalid value 'testdatabase' in mysql while importing sql data into a database.Its working fine when I do it on my local machine but same is not working on remote server through putty.I have copied the file on remote server. heres my query

 mysqldump -u root -p testdatabase < /home/user1/mydump.sql

remote machine(linux) mysql version : Ver 14.14 Distrib 5.6.14

local machine(windows 7) mysql version : Ver 14.14 Distrib 5.6.21

I got the same error message from mysqldump , except in my case the error was due to MySQL bug #41209 .

If you have a ~/.my.cnf that looks something like this

[client]
database=d6
[mysqldump]
databases=false

And you ran mysqldump > dump.sql , you would get the error message

mysqldump: ignoring option '--databases' due to an invalid value 'd6'

because the mysqldump utility reads the [client] section of the config file, and due to the way the MySQL CLI programs do option parsing, the --database option (recognized by the client, mysql ) is assumed to be an abbreviation for the completely unrelated --databases option (recognized by mysqldump ).

Ordinarily, the --database option for the client, mysql , specifies the name of the database to operate on, while the --database s option for mysqldump (note the s at the end) is a boolean switch that means "consider all 'name' arguments as databases to dump, rather than inferring the database name as being the first non-option argument on the command line, and the remaining 'names' as tables."

If its not getting reflected even though you tried @rups solution then there might be possibilty that database names are different across your machines. Check if database name in the host machine and remote machine is same.if no then make relevant changes to the database name and table name.

Mysql 恢复使用以下命令:

 mysql -u root -p testdatabase < /home/user1/mydump.sql

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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