Bug #71602 Unexpected option file read from basedir
Submitted: 6 Feb 2014 9:10 Modified: 7 Feb 2014 20:03
Reporter: Daniël van Eeden (OCA) Email Updates:
Status: Verified Impact on me:
Category:MySQL Server: Options Severity:S3 (Non-critical)
Version:5.6.15 OS:Any
Assigned to: CPU Architecture:Any

[6 Feb 2014 9:10] Daniël van Eeden
The /usr/my.cnf file is not listed in the list of option files returned by "mysqld --help --verbose", but it's read anyway.

The /etc/init.d/mysql file runs my_print_defaults with "-e /usr/my.cnf" if this file is present.

# Read defaults file from 'basedir'.   If there is no defaults file there
# check if it's in the old (depricated) place (datadir) and read it from there

if test -r "$basedir/my.cnf"
  extra_args="-e $basedir/my.cnf"
  if test -r "$datadir/my.cnf"
    extra_args="-e $datadir/my.cnf"

How to repeat:
# mysqld --help --verbose 2> /dev/null | grep -B 1 '/etc/my.cnf'
Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/etc/my.cnf ~/.my.cnf

Place and invalid config in /usr/my.cnf

Restart mysql....and watch the errorlog

strace confirms that "mysqld --help --verbose" is only reading the files listed.

Suggested fix:
Make sure all files read by mysqld are listed in the list of option files.

Try not to rely on this behaviour in the default installation: make sure $basedir/my.cnf and $datadir/my.cnf are not present.

Maybe add these location to the list of files read by "mysqld --help --verbose"
[6 Feb 2014 17:55] Sveta Smirnova
Thank you for the report.

I can not repeat described behavior. Please indicate which exact MySQL package (file name you downloaded) you use.
[6 Feb 2014 21:15] Daniël van Eeden
I use the 5.6.15 enterprise RPM (x86 64-bit)
[7 Feb 2014 16:54] Sveta Smirnova
Thank you for the feedback.

Where did you downloaded MySQL enterprise RPM? What is the exact name of the package? Exact name of package, available at My Oracle Support portal does not contain word "enterprise" and it does not place my.cnf under /usr/my.cnf
[7 Feb 2014 19:13] Daniël van Eeden
From Oracle eDelivery:
MySQL Database 5.6.15 RPM for Oracle Linux / RHEL 6 x86 (64bit) 	V41860-01 	214M

$ unzip -l V41860-01.zip 
Archive:  V41860-01.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
 18569720  2013-11-18 12:08   MySQL-client-advanced-5.6.15-1.el6.x86_64.rpm
 49582456  2013-11-18 12:10   MySQL-test-advanced-5.6.15-1.el6.x86_64.rpm
  3945164  2013-11-18 12:10   MySQL-shared-compat-advanced-5.6.15-1.el6.x86_64.rpm
 62701372  2013-11-18 12:10   MySQL-server-advanced-5.6.15-1.el6.x86_64.rpm
 85332128  2013-11-18 12:09   MySQL-embedded-advanced-5.6.15-1.el6.x86_64.rpm
  3274292  2013-11-18 12:08   MySQL-devel-advanced-5.6.15-1.el6.x86_64.rpm
  2004372  2013-11-18 12:10   MySQL-shared-advanced-5.6.15-1.el6.x86_64.rpm
    24643  2013-11-29 19:05   README.txt
---------                     -------
225434147                     8 files

The my.cnf gets created with mysql_install_db which is run in the postinstall script in the RPM file for MySQL-server-advanced-5.6.15-1.el6.x86_64.rpm
[7 Feb 2014 20:03] Sveta Smirnova
Thank you for the report.

Verified as described. I have to run mysql_install_db manually after installing RPM.