The following command gives the location of the files read in order of precedence for a default Mysql install on Ubuntu 16:

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

However, the first and third files do not exist; the second file contains the following:

# The MySQL database server configuration file.
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

# * IMPORTANT: Additional settings that can override those from this file!
#   The files must end with '.cnf', otherwise they'll be ignored.

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

If I follow the include directories only the 2nd contains a mysqld.cnf that indeed has a few lines of configuration data, but the settings it contains don't seem to have anything to do with how Mysql is actually configured (eg settings for Strict Mode) and nor does it link to another files via includedir.

Mysql 5.7 is a little different than earlier versions. If there are other files that contain settings to alter, where would it be located? If not, then is the best practice to simply create a /etc/my.cnf or /etc/mysql/my.cnf and override the mysqld.cnf? Add additional settings through another configuration file in the /etc/mysql/mysql.conf.d/ directory?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.