MySQL configuration settings

Post by: on November 27, 2010 | 0 Comment

I’m posting this here because I don’t want to forget it. I’ve used MySQL for almost 10 years, and I never picked up this tidbit of information. Knowing it long ago would have saved me some headaches.

If you’re setting up a MySQL connect string, if you use ‘localhost’, the driver will attempt to use the mysql.sock defined for your system. If you use ‘’ it uses the 3306 port that we’re all used to.

Here I was thinking that localhost:3306 would use the port.

This is particularly important on MacOS 10.6 Snow Leopard because the mysql.sock file isn’t in the expected location. I was installing a dev version of Drupal to test my themes locally and I kept hitting this error

Failed to connect to your MySQL database server. MySQL reports the following message: No such file or directory.

Changing to fixed it.