Bug #29854 mysqld --help --verbose retuns [ERROR] instead of printing help
Submitted: 17 Jul 2007 19:05 Modified: 5 Dec 2007 18:56
Reporter: Jan Kneschke Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Options Severity:S3 (Non-critical)
Version:5.1.19, 5.1 BK OS:Any
Assigned to: CPU Architecture:Any
Triage: Triaged: D3 (Medium)

[17 Jul 2007 19:05] Jan Kneschke
Description:
If the configuration files of the mysqld are broken, you can't call the help. 

The configuration is evaluated and verified it is valid before the --help is executed. This makes finding the right options impossible and is a chicken-egg problem:

To fix the problem, you need the help. To get the help, you first have to fix the problem.

How to repeat:
Start mysqld as normal user outside the datadir.

$ /usr/sbin/mysqld --help --verbose
070717 21:02:01 [Warning] options --log-slow-admin-statements and --log-queries-not-using-indexes have no effect if --log-slow-queries is not set
070717 21:02:01 [Warning] Can't create test file /var/lib/mysql/jan-dev.lower-test
070717 21:02:01 [Warning] Can't create test file /var/lib/mysql/jan-dev.lower-test
/usr/sbin/mysqld: File './hostname-bin.index' not found (Errcode: 13)
070717 21:02:01 [ERROR] Aborting

070717 21:02:01 [Note] /usr/sbin/mysqld: Shutdown complete

Suggested fix:
Don't fail on fatal config errors when --help is called. 

If you ignore the config-files with --no-defaults, it works:

$ /usr/sbin/mysqld --no-defaults --help --verbose
[17 Jul 2007 21:02] Sveta Smirnova
Thank you for the report.

But version 5.1.19 is old and I can not repeat described behaviour with development sources.

Please try with current version 5.1.20 and if you can repeat attach your configuration file.
[18 Jul 2007 10:29] Sveta Smirnova
Thank you for the report.

Verified using last BK sources.

To repeat:

$bin/mysql_install_db --basedir=. --datadir=./bug29854
Installing MySQL system tables...
070718 12:28:14 [Note] Plugin 'InnoDB' disabled by command line option
OK
Filling help tables...
070718 12:28:17 [Note] Plugin 'InnoDB' disabled by command line option
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h shella.mysql.com password 'new-password'
See the manual for more instructions.
You can start the MySQL daemon with:
cd /users/ssmirnova/build/mysql-5.1 ; ./bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl

Please report any problems with the /users/ssmirnova/build/mysql-5.1/bin/mysqlbug script!

The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com

$chmod -R 000 bug29854/
chmod: `bug29854/': Permission denied

$libexec/mysqld --no-defaults --help --log-bin=./bug29854/foo --datadir=bug29854 --verbose
070718 12:28:26 [Warning] Can't create test file /users/ssmirnova/build/mysql-5.1/bug29854/host.lower-test
070718 12:28:26 [Warning] Can't create test file /users/ssmirnova/build/mysql-5.1/bug29854/host.lower-test
libexec/mysqld: Can't change dir to '/users/ssmirnova/build/mysql-5.1/bug29854/' (Errcode: 13)
070718 12:28:26 [Warning] You have enabled the binary log, but you haven't set server-id to a non-zero value: we force server id to 1; updates will be logged to the binary log, but connections from slaves will not be accepted.
libexec/mysqld: File './bug29854/foo.index' not found (Errcode: 13)
070718 12:28:26 [ERROR] Aborting

070718 12:28:26 [Note] libexec/mysqld: Shutdown complete

Version 5.0 is not affected.
[18 Jul 2007 10:29] Jan Kneschke
Looking into the problem again and sorting out defaults:

The datadir has to exist, but should not be writable for the user.

$ /usr/sbin/mysqld \
  --no-defaults \
  --help --verbose \
  --log-bin=foo \
  --datadir=/var/lib/mysql/

070718 12:18:19 [Warning] Can't create test file /var/lib/mysql/jan-dev.lower-test
070718 12:18:19 [Warning] Can't create test file /var/lib/mysql/jan-dev.lower-test
/usr/sbin/mysqld: File './foo.index' not found (Errcode: 13)
070718 12:18:19 [ERROR] Aborting

$ /usr/sbin/mysqld --version
/usr/sbin/mysqld  Ver 5.1.19-beta-log for unknown-linux-gnu on x86_64 (MySQL Community Server (GPL))