Bug #87382 no mention in 5.7 documentation that mysqld.cnf is the authoritative option file
Submitted: 10 Aug 2017 19:39 Modified: 11 Aug 2017 13:17
Reporter: Brock Walters Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Documentation Severity:S2 (Serious)
Version:5.7.19-0ubuntu0.16.04.1 OS:Ubuntu (16.04.1)
Assigned to: CPU Architecture:Any
Tags: cnf, configuration, my.cnf, mysqld.cnf, option-file

[10 Aug 2017 19:39] Brock Walters
Description:
the default configuration file found in /etc/mysql/mysql.conf.d/mysqld.cnf is authoritative on Ubuntu 16.04 - this is not represented ANYWHERE in your 5.7 documentation. 

Worse the text at the TOP OF THIS FILE says:

"You can copy this to one of:
- "/etc/mysql/my.cnf" to set global options,
- "~/.my.cnf" to set user-specific options.

This is patently, categorically false.

How to repeat:
copy /etc/mysql/mysql.conf.d/mysqld.cnf to /etc/my.cnf
comment out the bind-address in /etc/my.cnf
leave the bind-address uncommented (active) in /etc/mysql/mysql.conf.d/mysqld.cnf
restart mysql
connect to mysql

expected: configuration in /etc/my.cnf is authoritative, ie, show variables like 'bind_address' should show *
actual: show variables like 'bind_address' shows '127.0.0.1' meaning the configuration in /etc/mysql/mysql.conf.d/mysqld.cnf is authoritative over the one in /etc/my.cnf contradicting the instructions in THE FILE ITSELF & YOUR ONLINE DOCS.

Suggested fix:
add documentation on this. change the top of the mysqld.cnf file so it mentions behavior on all host OS platforms
[11 Aug 2017 9:11] Umesh Shastry
Hello Brock Walters,

Thank you for the report.
Imho, this is documented behavior. Quoting from manual - "On Unix and Unix-like systems, MySQL programs read startup options from the files shown in the following table, in the specified order (top files are read first, files read later take precedence)." for table please see - https://dev.mysql.com/doc/refman/5.7/en/option-files.html

On my ubuntu 16.10, I see this

root@ubuntu16:/home/ushastry# /usr/sbin/mysqld --verbose --help | grep -A 1 "Default options"
Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf 

files read later take precedence, and when I checked contents of /etc/mysql/my.cnf which has again:

!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/

So, mysqld read option files found in /etc/mysql/mysql.conf.d/ i.e file names ending in .cnf and thus mysqld.cnf is taking precedence over /etc/my.cnf

Thanks,
Umesh
[11 Aug 2017 13:10] Brock Walters
you understand this means that if i follow the instruction AT THE TOP OF the mysqld.cnf file, ie, to copy it to /etc/my.cnf which was the location of the file on previous versions of Ubuntu that what happens is changes I make in /etc/my.cnf AFTER FOLLOWING THE INSTRUCTION AT THE TOP OF THE FILE are not respected, correct? I understand the !includedir action is explained. It's not clear. You should be removing or modifying the text at the top of the file for different flavors of Unix.
[11 Aug 2017 13:17] Brock Walters
you understand this means that if i follow the instruction AT THE TOP OF the mysqld.cnf file, ie, to copy it to /etc/my.cnf which was the location of the file on previous versions of Ubuntu that what happens is changes I make in /etc/my.cnf AFTER FOLLOWING THE INSTRUCTION AT THE TOP OF THE FILE are not respected, correct? I understand the !includedir action is explained. It's not clear. You should be removing or modifying the text at the top of the file for different flavors of Unix.

furthermore, why doesn't the documentation just say SOMEWHERE: "the default option-file on Ubuntu 16.04 is mysqld.cnf" It does not say that anywhere & your circular proof that it does is evidence of just how bad this documentation is.
[11 Aug 2017 13:17] Brock Walters
you understand this means that if i follow the instruction AT THE TOP OF the mysqld.cnf file, ie, to copy it to /etc/my.cnf which was the location of the file on previous versions of Ubuntu that what happens is changes I make in /etc/my.cnf AFTER FOLLOWING THE INSTRUCTION AT THE TOP OF THE FILE are not respected, correct? I understand the !includedir action is explained. It's not clear. You should be removing or modifying the text at the top of the file for different flavors of Unix.

furthermore, why doesn't the documentation just say SOMEWHERE: "the default option-file on Ubuntu 16.04 is mysqld.cnf" It does not say that anywhere & your circular proof that it does is evidence of just how bad this documentation is.