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 = testdatabase
[mysqldump]
databases = false
And you ran mysqldump > dump.sql
, you would get the error message
mysqldump: ignoring option '--databases' due to an invalid value 'testdatabase'
The error comes about because mysqldump
reads both the [client]
and [mysqldump]
sections of the config file. Due to the way the MySQL CLI programs do option parsing, mysqldump
assumes database
(i.e. the --database
option recognized by mysql
) is short for databases
(i.e. the --databases
option recognized by mysqldump
), hence the error. It is a long-standing bug.
Ordinarily, the --database
option for the client, mysql
, specifies the name of the database to operate on, while the --databases
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.
How do you solve it?
database
from the [client]
section of your ~/.my.cnf
and specify it as an argument to mysql
instead--defaults-group-suffix
option; make yourself a shell alias if you feel like that option is too much to remember/typeIf 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With