phpMyAdmin is throwing a #2002 cannot log in to the mysql server phpmyadmin

If you’re getting the #2002 Cannot log in to the MySQL server error while logging in to phpmyadmin, try editing phpmyadmin/config.inc.php and change:

$cfg['Servers'][$i]['host'] = 'localhost';

to:

$cfg['Servers'][$i]['host'] = '127.0.0.1';

Solution from Ryan’s blog

Edit (20-Mar-2015):

Note that if you’re on a fresh install, config.inc.php may not exist. You need to rename / copy config.sample.inc.php and then change the relevant line

Leave a Comment