WordPress on OS X Tiger – “error establishing a database connection”

Installing WordPress on OS X Tiger and getting the ambiguous “error establishing a database connection” error?  Fixing this problem was easy for me, once I knew what to do.

The problem is with your php.ini file.  The default socket value is initially blank:

mysql.default_socket =

To get WordPress to work, you need to set a default socket.  Values that have worked in some situations include:

mysql.default_socket = /private/tmp/mysql.sock

mysql.default_socket = /tmp/mysql.sock

In my particular situation (default MySQL and Apache installs on Tiger), I had to use the following socket:

mysql.default_socket = /opt/local/var/run/mysql5/mysqld.sock

For info on locating and modifying your php.ini file, see the Bust Out Solutions blog.