At some point in the last month (been on holiday mostly) an Apple system update caused MySQL to stop running – all local development sites using MySQL would give the dreaded “Error establishing a database connection” error message. And phpMyAdmin refused to recognize my user/pass credentials.
It seems that Apple has once more made it necessary to explicitly state the MySQL default socket. As stated in this post Mac, WordPress: “Error establishing a database connection” you should edit the mysql.default_socket = line in your php.ini file to read mysql.default_socket = /tmp/mysql.sock .
If you don’t know where to look it’s to be found in an invisible folder at the root of your hard drive called “etc”. To get there go to the menu bar when in the Finder: Go -> Go to Folder… or use this shortcut: [Apple]+[Shift]+G ) then type: /etc .
I’d recommend the excellent (and free) TextWranger to edit the file – as it makes it a breeze by automatically authorizing your changes with a prompt for you admin password when needed.
The change is easy – find the line that reads mysql.default_socket = then add /tmp/mysql.sock to the end.
The line should now read mysql.default_socket = /tmp/mysql.sock
Save the file the restart your Apache webserver by going the System Preferences and stopping, then starting again Web Sharing (found in the Sharing pane).