| Bug #78986 | "mysqld --help --verbose" creates a file in the data directory | ||
|---|---|---|---|
| Submitted: | 27 Oct 2015 20:29 | Modified: | 10 Nov 2015 16:59 |
| Reporter: | Giuseppe Maxia (OCA) | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: Installing | Severity: | S2 (Serious) |
| Version: | 5.7.9 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
[27 Oct 2015 21:12]
MySQL Verification Team
Thank you for the bug report.
C:\dbs>dir 5.7\data
Volume in drive C has no label.
Volume Serial Number is 0C1C-80A8
Directory of C:\dbs\5.7\data
27/10/2015 19:09 <DIR> .
27/10/2015 19:09 <DIR> ..
27/10/2015 19:09 0 mysql-bin.index
1 File(s) 0 bytes
2 Dir(s) 412.903.100.416 bytes free
[28 Oct 2015 8:34]
Lars Tangvald
This is related to an earlier bug, where innodb initialization caused the same problem: http://bugs.mysql.com/bug.php?id=75995
[10 Nov 2015 16:59]
Paul DuBois
Noted in 5.7.10, 5.8.0 changelogs. If mysqld was started with the --help option, it created a binary log index file. If that file was located in the data directory and the command preceded data directory initialization, initialization then failed due to a nonempty data directory.

Description: When /etc/my.cnf contains "log-bin" and we run "mysqld --help --verbose", the server creates a file in the data directory. When we then try to run "mysqld --initialize" the installation fails because the data directory is not empty. Scenario 1: Without a data directory: # /etc/my.cnf contains "log-bin" $ bin/mysqld --verbose --help --basedir=$PWD |grep datadir mysqld: Can't change dir to $PWD/data/ (Errcode: 2 - No such file or directory) -h, --datadir=name Path to the database root directory collecting database names from the datadir. Put a blank datadir $PWD/data/ Here you see that mysqld tries to access the data directory, but fails Scenario 2: the data directory exists # /etc/my.cnf contains "log-bin" $ mkdir data $ bin/mysqld --verbose --help --basedir=$PWD |grep datadir -h, --datadir=name Path to the database root directory collecting database names from the datadir. Put a blank datadir $PWD/data/ $ ls data/ mysql-bin.index $ mysqld --basedir=$PWD --datadir=$PWD/data --initialize 2015-10-27T20:25:02.255725Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2015-10-27T20:25:02.260100Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting. 2015-10-27T20:25:02.260406Z 0 [ERROR] Aborting How to repeat: 1) add the following to /etc/my.cnf: [mysqld] log-bin=mysql-bin server-id=1 2) create the data directory $ mkdir data 3) run $ bin/mysqld --verbose --help --basedir=$PWD Suggested fix: The server should never attempt to create files when called with "--help". This bug affects docker operations (https://bugs.mysql.com/bug.php?id=78957)