Can you tell me why MySQL 8 is not using my.cnf on macOS Mojave?

2.7k views Asked by At

I am trying to setup the MySQL I have installed on my Mac. Mac is 10.14.6 Mojave. MySQL is 8.0.21.

I have created a my.cnf file in the main mysql directory, which is /usr/local/mysql.

I have set the path to the config file using the system preferences pane for MySQL (select 'Configuration File', press "Select" button ad navigate to/select file).

Restarted server (many times!) and MySQL is just not 'seeing' or using the my.cnf.

I have put many 'whacky' test settings in the file to see if it is being used; port changed to 3308 (MySQL Workbench still connects and says it is 3306), changed location of general and error logs (no sign of them in new location) etc etc.

Can anybody suggest what I am doing wrong and why my.cnf is not being used?

Many thanks
Mark

1

There are 1 answers

0
Mark Ogier On

Thanks to the guys that responded. @nbk put me on the right track, but in this instance it was not due to the config file being in the wrong place as so many others have found. It was due to permissions.

In fact the permissions being TOO RELAXED! Not that MySQL could not read the file but that it detected that EVERYONE could read the file and so it ignored it. That to me is bonkers, and if you must be so draconian about reading a text file then at least put a message in the **** log file!

Anyway, this was the answer as found in the post linked above by @nbk and repeated here. The original poster of the answer was JayRizzo, so thanks to him as well for his very complete response to the previous question that put me on the right track.

Source


Important Notes:

On Unix platforms, MySQL ignores configuration files that are world-writable.

This is intentional as a security measure. In other words, if you have the wrong permissions set on your config file the will NOT load.

Example of initial setup permission of one of the config files:

$ ls -lah /etc/my.cnf
-rw-r--r--  1 myusername  wheel     0B Feb 25 20:40 /etc/my.cnf