Cake is Unable to Connect to Database on Snow Leopard – MySQL

Playing around with CakePHP today.  Ran into a problem where I know – absolutely – that my database.php was correct in Cake.  However, I kept getting this error:

Cake is NOT able to connect to the database.

Keep in mind, I’m using the Apache out of the box with Snow Leopard.

The fix was easy, but man, what a pain!

So I’m writing this to help anyone else that finds this problem…

1. Goto /private/etc/php.ini  (use TextWrangler or vi)
2. Search for ‘mysql.default_socket’ – should be under the [MySQL] section.  For me it was line 1227
3. Modify to look like the following:

;mysql.default_socket = /var/mysql/mysql.sock         <== this is what it was
mysql.default_socket = /private/tmp/mysql.sock
Save it – and restart Apache.
Good luck!
Advertisements

One thought on “Cake is Unable to Connect to Database on Snow Leopard – MySQL

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s