Question

#2002 - No such file or directory — The server is not responding (or the local server's socket is not correctly configured).

Posted August 27, 2019 10.8k views
MySQLApachePHPUbuntu 18.04

When I try to login my PHPMyAdmin, I get the following error messages:

#2002 - No such file or directory — The server is not responding (or the local server's socket is not correctly configured).

mysqli_real_connect(): (HY000/2002): No such file or directory

Connection for controluser as defined in your configuration failed.

Error screenshot: https://www.screencast.com/t/TciiR9NIBi

but after rebooting my droplet, I am able to use my WordPress and PHPMyAdmin normally without any errors!

It’s really frustrating to get that error randomly!
Please help me.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
2 answers

Hello,

I would recommend changeinglocalhost to 127.0.0.1 in your config.inc.php PHPmyAdmin file.

It should look something like this after the change:

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

That way when using 127.0.0.1 PHPmyAdmin would make a TCP connection which should work.

Let me know how it goes.
Regards,
Bobby

I’m having the same error and it pops randomly also. The above fix it didn’t worked for me. That line is commented and I have this instead:

/* Authentication type */
    $cfg['Servers'][$i]['auth_type'] = 'cookie';
    /* Server parameters */
    if (empty($dbserver)) $dbserver = '127.0.0.1';
    $cfg['Servers'][$i]['host'] = $dbserver;

    if (!empty($dbport) || $dbserver != '127.0.0.1') {
        $cfg['Servers'][$i]['connect_type'] = 'tcp';
        $cfg['Servers'][$i]['port'] = $dbport;
    }

A you can see i have replaced the localhost with the IP suggested but still that error pops up from time to time. Any suggestion?

Submit an Answer