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

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:

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.

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Bobby Iliev
Site Moderator
Site Moderator badge
August 27, 2019
Accepted Answer


I would recommend changeinglocalhost to in your PHPmyAdmin file.

It should look something like this after the change:

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

That way when using 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 = '';
    $cfg['Servers'][$i]['host'] = $dbserver;

    if (!empty($dbport) || $dbserver != '') {
        $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?

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel