OSX MySQL setup for phpMyAdmin

Seems I can still be a noob at this game after all these years. Spent hours on this, trying all sorts of combinations and getting so frustrated, I started making mistakes…

Anyway I figured I should share.

When connecting to the MySQL setup by default on OS/X, the settings are kind of weird. In the config.inc.php for phpMyAdmin (which you need to create if installing for the first time – copy the config.sample.inc.php in the phpMyAdmin root directory) the settings should be:

$cfg['Servers'][$i]['host'] = ''; /* localhost DOESN'T work */
$cfg['Servers'][$i]['port'] = '';/* leave blank, we're using sockets */
$cfg['Servers'][$i]['socket'] = '/tmp/mysql.sock'; /* the socket */
$cfg['Servers'][$i]['connect_type'] = 'socket'; /*tcp is disabled */
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'cookie'; /* easiest way to set it up */
$cfg['Servers'][$i]['user'] = ''; /* leave these two blank */
$cfg['Servers'][$i]['password'] = '';


The thing that knocked me about was I kept using localhost. For some reason (that will probably get explained to me at some point) localhost and are not the same thing in this scenario, even though the /etc/hosts file says they should be!

One for the knowledgebase, so when I am configuring my next Mac, I’ll have a reference!