Bug #41209 mysqldump: ignoring option '--databases' due to invalid value
Submitted: 3 Dec 2008 18:19 Modified: 4 Dec 2008 9:37
Reporter: Bob Vincent Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: mysqldump Command-line Client Severity:S3 (Non-critical)
Version:5.0.32 (Ver 10.11 Distrib 5.0), 4.1, 5.0, 5,1, 6.0 bzr OS:Linux (Ubuntu Intrepid)
Assigned to: CPU Architecture:Any
Triage: Triaged: D4 (Minor)

[3 Dec 2008 18:19] Bob Vincent
Description:
There is an ambiguity whenever the "database" option is set within the [client] section of a .my.cnf configuration file.  This happens because the "database" option used by the mysql client is also an acceptable abbreviation for the "databases" option used by the mysqldump and mysqlcheck clients.

However, even though the latter clients interpret this option as a boolean true/false flag, a setting of "databases" within their respective sections does not override an earlier setting of "database" within the [client] section.  Instead, they accept multiple settings and interpret them successively.

In my installation, I have a database called "d6".

With a .my.cnf containing:

[client]
database=d6
[mysqldump]
databases=

mysqldump reports:

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

With a .my.cnf containing:

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

msqldump reports:

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

With a .my.cnf containing:

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

mysqldump also reports:

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

How to repeat:
This warning message appears whenever running the mysqldump command-line client with a .my.cnf file containing:

[client]
database=(any valid database name)

Suggested fix:
In order of most-desirable to least-desirable:

1. For command-line clients which accept the '--databases' option, require the option to be fully specified, so that it doesn't conflict with the shorter "--database" option allowed by the mysql client.

2. Allow a 'databases' setting in a specific client section to override, rather than append to, a 'database' setting in the [client] section.

3. Suppress the warning message since this option is ambiguous by design.

4. Change the warning message to report 'invalid option' rather than 'invalid value'.
[4 Dec 2008 9:37] Sveta Smirnova
Thank you for the report.

Verified as described: mysqldump accepts option --database and treats it in the same way as databases.

Category left unchanged, although I think this is most likely documentation problem.
[23 Feb 2010 14:38] Charles Norton
I am getting the same problem. 

Platform is Ubuntu and Red Hat Linux. 

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 41
Server version: 5.1.37-1ubuntu5.1 (Ubuntu)

Here is a pointer to my post, where it was suggested I enter a bug. Instead, I am tacking my information onto this bug:

http://forums.mysql.com/read.php?10,354752,354752#msg-354752

Thanks.