I can't login to PHPMyAdmin getting error as #2002 - Network is unreachabl, I installed PHPMyAdmin from source.

Configuration I tried in config.inc.php to fix the issue.

$cfg['Servers'][$i]['host'] = '127.0 0.1';
$cfg['Servers'][$i]['connect_type'] = 'tcp';

Another fix I Tried is to set mysql.default_socket to /var/lib/mysql/mysql.sock but I didn't find one In my php.ini file I find pro_mysql.default_socke and not mysql.default_socket, Do I need to add the mysql.sock path to pro_mysql.default_socke

enter image description here

1 Answer 1


You're asking phpMyAdmin to connect by TCP but your database is listening to an UNIX socket. Remove the connect_type line and set host to localhost:

$cfg['Servers'][$i]['host'] = 'localhost';
  • Its not working getting the same error, I had the default setting as localhost to fix this issue I tried with 127.0 0.1
    – fernandus
    Commented Oct 30, 2017 at 7:46
  • Use for TCP connections. Use localhost for UNIX domain sockets. Make sure your web server doesn't run chrooted to use UNIX domain sockets. Don't mess with the default socket values in my.cnf and php.ini if you don't know what you're doing. Commented Oct 30, 2017 at 8:10
  • I haven't done any configuration with chrooted to use UNIX domain sockets. If so How can I check. I really don't know what it means :(
    – fernandus
    Commented Nov 1, 2017 at 11:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .