MySQL socket port on Mac OS X

Every time I reinstall my system software, or set up a new machine, I break phpMyAdmin’s socket connection. Recently, information in this post helped me sort it out.

First, find out where MySQL is putting its socket:

> /usr/local/mysql/bin/mysqladmin variables
| socket     | /tmp/mysql.sock|

And then point phpMyAdmin to it by changing these lines in the config.inc.php file:

$cfg['Servers'][$i]['socket']   = '/tmp/mysql.sock';
$cfg['Servers'][$i]['connect_type']  = 'socket';

You might also (or instead) need to create a link from where MySQL has its socket to the location in which PHP thinks the socket should be:

>sudo ln -h /tmp/mysql.sock /var/mysql/mysql.sock