Bug #63187 mysqld --help --verbose should not try to startup but only provide help
Submitted: 10 Nov 2011 15:36 Modified: 16 Oct 2012 5:13
Reporter: Simon Mudd (OCA) Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Options Severity:S3 (Non-critical)
Version:5.5.16, 5.5.19 OS:Any (Linux, Mac OS X)
Assigned to: CPU Architecture:Any
Tags: windmill

[10 Nov 2011 15:36] Simon Mudd
Description:
mysqld --help --verbose is supposed to provide configuration information, yet the startup shows that the server is doing more than just that:

/usr/local/mysql/bin/mysqld
[sjmudd@my-host]$ mysqld --help --verbose
111110 16:28:14 [Warning] Can't create test file /usr/local/mysql/data/my-host.lower-test
111110 16:28:14 [Warning] Can't create test file /usr/local/mysql/data/my-host.lower-test
111110 16:28:14 [Warning] lower_case_table_names was set to 2, even though your the file system '/usr/local/mysql/data/' is case sensitive.  Now setting lower_case_table_names to 0 to avoid future problems.
mysqld: File './binlog.index' not found (Errcode: 13)
mysqld  Ver 5.5.16-log for osx10.6 on i386 (MySQL Community Server (GPL))
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Starts the MySQL database server.

Usage: mysqld [OPTIONS]

Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf 
The following groups are read: mysqld server mysqld-5.5
The following options may be given as the first argument:
--print-defaults        Print the program argument list and exit.
--no-defaults           Don't read default options from any option file.
...

mysqld --help seems to behave correctly:

[sjmudd@my-host]$ mysqld --help
mysqld  Ver 5.5.16-log for osx10.6 on i386 (MySQL Community Server (GPL))
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Starts the MySQL database server.

Usage: mysqld [OPTIONS]

For more help options (several pages), use mysqld --verbose --help.
[sjmudd@my-host]$ 

How to repeat:
Startup mysqld as indicated.

Suggested fix:
I believe the --help option should only show "help information". It should not "try to start up", or perform any external actions other than provide the required text information.  This seems to work as advertised. However, mysqld --help --verbose additionally provides configuration information and should behave the same way.  It looks like it's currently trying to "do things" which it should not.
[10 Nov 2011 16:10] Valeriy Kravchuk
Thank you for the problem report. Verified just as described with current 5.5.19 on Fedora Core 14. I do not see this problem on Windows though.
[15 Nov 2011 10:05] Hartmut Holzgraefe
See also bugs #30970, #30261, #31106
[15 Nov 2011 18:37] Simon Mudd
Note: one thing that is mentioned in http://bugs.mysql.com/bug.php?id=30970 says:

"--help output often contains information on current default settings
so reading the option file is required in these cases. An error message
should only be printed when reaching this part of the help output though
*after* printing the usage information."

I disagree. I think there's a very valid reason for mysqld to be able to provide the DEFAULT settings (hard-coded settings built-in to the mysqld binary) _without_ reading _any_ configuration files and provide that information to the DBA.  There may be a similar requirement to show the settings that would be applied _after_ reading any configuration files but that should be a separate requirement.

Either way mysqld --help --verbose should _not_ attempt to write to any files.
[5 Dec 2011 17:39] Simon Mudd
Also see: http://blog.wl0.org/2011/11/managing-mysqls-configuration/ this current behaviour is really irritating as I'm trying to use this "only" mechanism of getting default information out of the binaries so I can check how my servers configuration varies to the default settings is troublesome to put it mildly.
[16 Oct 2012 5:13] Erlend Dahl
MySQL --help will print information about variables in various dynamically
loadable plugins. So it will always need to attempt loading those plugins
before printing out the help information.