Barry Hughes WordPress Developer

Overriding MySQL settings

17 January 2018

Every now and again it’s time to setup a new machine and I wrestle with getting MySQL to observe my custom bind_address and other settings. Which settings file should I override and in which order are they consumed by the MySQL server, anyway?

mysql --help

The output from the above command contains the answer. Aside from some typical help file stuff about various options and switches, it also shows the value of various server variables and contains a section like this example, from which you can learn the order in which MySQL loads .cnf files:

Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf 
The following groups are read: mysql client

Now I know the order of precedence, as well as the groups that are actually read in.

🖇 Databases | MySQL | quicktip