4

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?

0

After much much much frustration trying to even get access to the mysql prompt, including reinstalling several times, I uninstalled it again and followed this installation guide on DigitalOcean. It includes some optional steps after installing that allow you to actually have access to everything the way you would think.

It also describes common practices and setups in a way that's actually understandable/helpful. The guide for 18.04 goes more into depth for what I needed, but you can select for your OS version as well. I know you asked a while ago, but hopefully this helps someone struggling with mysql configuration!

If you have databases present and want to uninstall/reinstall/reconfigure, you can always do a mysqldump.

1
  • Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference.
    – Thomas Ward
    Mar 17 '20 at 23:03

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.