MySQL 5.1 knows /etc/mysql/my.cnf

OK, this is maybe no big news and maybe old, but I needed an excuse to blog something!

Since MySQL 5.1.15 the /etc/mysql/my.cnf has been added as default location after /etc/my.cnf. This is great and something I like keeping /etc a bit cleaner, but it might be tricky for some not knowing!

I found this the hard way and a bit with red cheeks (I’m a MySQL Support Engineer after all..). After installing postfix-mysql Ubuntu package, which also sets up common MySQL stuff, I couldn’t connect to my fresh installed 5.1.19. Confused, I saw it was using a socket setting I didn’t specify. So, /etc/mysql/my.cnf was read extra to /etc/my.cnf! I said ‘doh!’ and saw it was good.

Tip: leave /etc/my.cnf there for a while with a warning like “You’re living in the past dude! Check /etc/mysql/my.cnf”, or something.

Next would be to read /etc/mysql/config.ini for MySQL Cluster too, but work is on its way to make this file obsolete anyway.