Bug #18209 mysqldump: ignoring option '--databases' due to invalid value 'xcc'
Submitted: 14 Mar 2006 8:04 Modified: 5 Dec 2008 8:40
Reporter: Olaf van der Spek (Basic Quality Contributor) Email Updates:
Status: Closed
Category:Client Severity:S3 (Non-critical)
Version:5.0.18 OS:Linux (Debian)
Assigned to: Magnus Blaudd Target Version:

[14 Mar 2006 8:04] Olaf van der Spek
Description:
Hi,

I added database = xcc to .my.cnf and now I get warnings from mysqldump. I think
mysqldump should ignore .my.cnf - database when a database has been given on the command
line

How to repeat:
.my.cnf:
[client]
user = xcc
password = *
database = xcc

$ mysqldump -u xcc xcc <lots of tables>
mysqldump: ignoring option '--databases' due to invalid value 'xcc'
[14 Mar 2006 12:38] Hartmut Holzgraefe
verified using "database = mysql" in .my.cnf
[11 May 2006 9:44] Magnus Blaudd
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.mysql.com/documentation/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

Additional info:

The "--databases" argument to mysqldump(and other mysql tools) is a flag indicating that
_all_ the name arguments on the command line should be treated as database names. It's
thus working as expected. 

See this section in the manual http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html and
the below descripton

"--databases, -B

Dump several databases. Normally, mysqldump treats the first name argument on the command
line as a database name and following names as table names. With this option, it treats
all name arguments as database names. CREATE DATABASE and USE statements are included in
the output before each new database. "
[11 May 2006 11:47] Olaf van der Spek
> The "--databases" argument to mysqldump(and other mysql tools) is a flag
indicating that _all_ the name arguments on the command line should be treated
as database names. It's thus working as expected. 

Who's talking about --databases?
[11 May 2006 11:53] Magnus Blaudd
Got it. Will have another look. Sorry for the confusion.
[11 May 2006 13:16] Magnus Blaudd
If I write "dat=xcc" in my.cnf that will be interpreted by mysqldump as I mean the
"--databases" argument and it will print the same error message.
[11 May 2006 13:22] Olaf van der Spek
Indeed, but mysqldump should ignore the value in my.cnf, at least in this case.
[12 May 2006 15:53] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/6311
[12 May 2006 15:55] Magnus Blaudd
Any easy fix is otherwise to move the parameter "database=xyz" to the [mysql] section of
my.cnf as that section will only be read by mysql command line client.
[17 May 2006 12:11] Magnus Blaudd
It is by design possible to write the options on a short format if they are unambiguos.
Thus "--database=xyz" will be interpreted as "--databases" by mysqldump.
[3 Dec 2008 17:41] Bob Vincent
Has the patch made it to the main codebase yet?  My "mysql --version" outputs:

mysql  Ver 14.12 Distrib 5.0.32, for pc-linux-gnu (i486) using readline 5.2

... and it still has this problem.

Also, the error message seems to be wrong, or at least misleading.  It says "ignoring ...
due to invalid value" which implies that there exists a valid value.

Since the "--databases" option doesn't accept a valid database name, (I reasoned to
myself,) perhaps it is a boolean true/false flag.  So I tried setting it to an empty
string, numeric zero, and 'false'.  The empty string is reported to be invalid, and both
the numeric zero and 'false' are ignored as if they hadn't been specified.  That is, a
.my.cnf containing:

[client]
database=d6
[mysqldump]
databases=

... results in:

mysqldump: ignoreing option '--databases' due to invalid value ''

... and a .my.cnf containing:

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

... results in:

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

... and a .my.cnf containing:

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

... also results in:

mysqldump: ignoring option '--databases' due to an invalid value 'd6'
[5 Dec 2008 8:39] Magnus Blaudd
Just read the previous posts and you'll see that mysqldump does not have a --database
option it's --databases - with an ending s! Then read the previous posts again ;) to
learn what --databases does.
[5 Dec 2008 8:40] Olaf van der Spek
> to learn what --databases does.

As you can see, it's confusing to users. A solution would be appreciated.