I’ll introduce how to configure my.cnf for MySQL installed with Homebrew on Mac.
First, find where my.cnf is loaded from.
$ mysql --help | grep /my.cnf
/etc/my.cnf /etc/mysql/my.cnf /usr/local/etc/my.cnf ~/.my.cnf
They are loaded in order from left to right with priority. For custom configuration, it’s recommended to add to /usr/local/etc/my.cnf or ~/.my.cnf.
Next, find the location of the MySQL configuration files my*.cnf installed with Homebrew.
$ find /usr/local/Cellar/mysql -name "my*.cnf"
/usr/local/Cellar/mysql/5.7.17/support-files/my-default.cnf
Copy and use my-default.cnf.
$ cp /usr/local/Cellar/mysql/5.7.17/support-files/my-default.cnf /usr/local/etc/my.cnf
After that, just configure my.cnf nicely and you’re done.
You can check the my.cnf configuration before and after with the following command.
$ mysql -u root -p
mysql> show variables;
That’s all. Now configure it however you like.
That’s all from the Gemba.