Bug #30994 confusing messages with --no-defaults not being first option
Submitted: 13 Sep 2007 8:51 Modified: 13 Sep 2007 16:29
Reporter: Hartmut Holzgraefe Email Updates:
Status: Verified Impact on me:
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:any OS:Any
Assigned to: CPU Architecture:Any
Tags: usability

[13 Sep 2007 8:51] Hartmut Holzgraefe
--no-defaults and other options that have an influence on the way my.cnf option files are parsed only work if given as first command line options

When using these options later on the command line the error message given is either confusing:

  $ mysqldump -u root --no-defaults
  mysqldump: unknown option '--no-defaults'

as the option is actually *not* an unknown one

or the message given is totally missing the point:

  $ mysqladmin shutdown
  mysqladmin: unknown variable 'database=test'

ok, no real problem so far, just some my.cnf entry
in the [client] section that is in the way. Lets
try to ignore the options file for now:

  $ mysqladmin --no-defaults shutdown
  mysqladmin: connect to server at 'localhost' failed
  error: 'Access denied for user 'hartmut'@'localhost' (using password: NO)'

Ok, we need to add the --user option, too.
Now what if we forget about the "--no-defaults always
first" rule?

  $ mysqladmin --user root --no-defaults shutdown
  mysqladmin: unknown variable 'database=test'

Now --no-defaults is just silently ignored and
we're back to the original error message again.

Quite confusing if you do not know about the
--no-defaults limitation (which is easy to overlook)

The error feedback should be more helpfull here ...

How to repeat:
#1 try

  mysqladmin --user=root --no-defaults version

#2 now put the following into your my.cnf:


and then try 

  mysqladmin --user=root --no-defaults version

Suggested fix:
Change the error message from "unknown option"
to "option xxx may only be used at the very start
of the option list"

Always print this message if --no-defaults and 
friends are used in the wrong place, even in
addition to other error messages. Do not drop
this error information as it may be related.
[13 Sep 2007 16:29] MySQL Verification Team
Thank you for the bug report.