Bug #31106 errors whenn running "mysqld --help" before "mysql_install_db"
Submitted: 20 Sep 2007 11:17 Modified: 20 Sep 2007 11:21
Reporter: Hartmut Holzgraefe Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Options Severity:S3 (Non-critical)
Version:5.1.20 OS:Any
Assigned to: CPU Architecture:Any
Tags: usability

[20 Sep 2007 11:17] Hartmut Holzgraefe
Description:
"mysqld --help" runs into permission errors when executed by a normal user not matching the owner of the mysql install prefix:

hholzgraefe@ndbsup-1 ~]$ /data1/mysql/5.1.20/libexec/mysqld --help
070920 13:14:26 [Warning] Can't create test file /data1/mysql/5.1.20/var/ndbsup-1.lower-test
070920 13:14:26 [Warning] Can't create test file /data1/mysql/5.1.20/var/ndbsup-1.lower-test
/data1/mysql/5.1.20/libexec/mysqld: Can't change dir to '/data1/mysql/5.1.20/var/' (Errcode: 2)
/data1/mysql/5.1.20/libexec/mysqld: Table 'mysql.plugin' doesn't exist
070920 13:14:26 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
/data1/mysql/5.1.20/libexec/mysqld  Ver 5.1.20-beta-debug for unknown-linux-gnu on x86_64 (Source distribution)
Copyright (C) 2000 MySQL AB, by Monty and others
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license

Starts the MySQL database server

Usage: /data1/mysql/5.1.20/libexec/mysqld [OPTIONS]

For more help options (several pages), use mysqld --verbose --help

How to repeat:
try running "mysqld --help" or "mysqld --help --verbose" before mysql_install_db

Suggested fix:
calling a binary with --help should *never* try to create any file
[20 Sep 2007 11:19] Domas Mituzas
related to Bug#28417 (sitting in void for many months).
[20 Sep 2007 11:21] Geert Vanderkelen
Verified using latest 5.1bk.
[20 Jul 2009 5:40] Sveta Smirnova
Bug #46271 was marked as duplicate of this one.
[15 Oct 2014 11:18] Daniël van Eeden
This was fixed with Bug #68578 but there seems to be a regression with 5.7.5-m15

mysqld --help --verbose > /dev/null
2014-10-15T11:16:11.226371Z 0 [ERROR] Can't find error-message file '/usr/share/errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.
mysqld: Can't change dir to '/var/lib/mysql/' (Errcode: 2 - No such file or directory)
mysqld: Unknown error 1146
2014-10-15T11:16:11.229925Z 0 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2014-10-15T11:16:11.230029Z 0 [ERROR] unknown variable 'key_buffer=16M'
2014-10-15T11:16:11.236014Z 0 [ERROR] Aborting
[20 Oct 2014 13:04] Alexander Nozdrin
Daniël,

could you clarify that a bit?

I built & installed (make install) 5.6.21 and 5.7.5.
I didn't initialize the datadir.

Both versions report errors:
  mysqld: Table 'mysql.plugin' doesn't exist
  Can't open the mysql.plugin table. Please run mysql_upgrade to create it.

5.7 in addition says:
  mysqld: Can't change dir to '/usr/local/mysql/data/' (Errcode: 2 - No such file or directory)

Is that what you're referring to?

Btw, the changeset comment for Bug#68578 says:

  mysqld --help [--verbose] printed various diagnostics to
  stderr, which is a fine place for it. When --verbose is
  given, we need to go through a full initialization of our
  plugins so they can add their variables to the list we'll
  print. --help without --verbose only printed one unexpected
  line, which we'll now suppress for tidyness.

so, having at least some error messages for '--help --verbose'
seems to be intentional.

Thanks.
[25 Oct 2014 21:09] Daniël van Eeden
What happened for me is this:
I've extracted multiple versions of mysql in ~/mysql/<version> (I use MySQL Sandbox) and my system has a /etc/mysql/my.cnf (From the mysql-common package on my system).

The my.cnf from mysql-common is make for 5.6, that's why there are more messages from 5.7 than from 5.6.

Using --no-defaults as the first argument to ignore /etc/mysql/my.cnf gives a lot less messages.

--------------------------------------------------------------------
~/mysql/5.7.5-m15$ ./bin/mysqld --help --verbose > /dev/null
2014-10-25T20:44:47.908910Z 0 [ERROR] Can't find error-message file '/usr/share/errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.
mysqld: Can't change dir to '/var/lib/mysql/' (Errcode: 2 - No such file or directory)
mysqld: Unknown error 1146
2014-10-25T20:44:47.913353Z 0 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2014-10-25T20:44:47.913439Z 0 [ERROR] unknown variable 'key_buffer=16M'
2014-10-25T20:44:47.917421Z 0 [ERROR] Aborting

~/mysql/5.7.5-m15$ ./bin/mysqld --no-defaults --help --verbose > /dev/null
2014-10-25T20:45:03.037110Z 0 [ERROR] Can't find error-message file '/usr/local/mysql/share/errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.
mysqld: Can't change dir to '/usr/local/mysql/data/' (Errcode: 2 - No such file or directory)
mysqld: Unknown error 1146
2014-10-25T20:45:03.039125Z 0 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
--------------------------------------------------------------------

Unknown error 1146 is ER_NO_SUCH_TABLE.

@Alexander Your comments make a lot of sense from the standpoint of a developer. But I don't think it makes sense from a DBA's perspective.

A DBA would run "mysqld --verbose --help" because that's what the output of "mysqld --help" tells you to do:
"For more help options (several pages), use mysqld --verbose --help."

So "--verbose --help" should just show the list of options and should not try to initialize or do anything.

I don't think I now any other applications which will emit errors with "--help" (except for some applications where glib reports an assertion error, but that's not really the app and also a bug).

Maybe all errors/warnings can get suppressed when --help --verbose is called?

The errors are just a minor annoyance, but I really hope that no changes to my system are made when running --help --verbose.