Description:
--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:
[client]
database=test
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.