Vesta error 2002: Can't connect to localhost

May 19, 2015 1.6k views
Control Panels MySQL WordPress Scaling LAMP Stack


I'm a designer, not a developer or programmer.

Instructions with commands are can be overwhelming as I don't even know where I would enter the initial command. (e.g., We can see if the system has any configured swap by typing: sudo swapon -s )


I've got three Wordpress sites down and here's the email I'm getting from Vesta.

Can't connect to localhost
ERROR 2002 (HY000): Can't connect to local MySQL server through socket 
'/var/run/mysqld/mysqld.sock' (111)

Do I have to do one of these things:

  1. Upgrade to a larger droplet.
  2. Enable Swap.
  3. Modify the configurations for Apache and MySQL to reduce memory use.

(I found the above here:

1 Answer

The error you are seeing is only indicative that your MySQL server isn't able to be connected to - this could mean that it is down, but there are many other potential issues. You would want to look at your MySQL logs to determine the issue - likely located in /var/log/mysql/mysql_error.log which you would look at by typing nano /var/log/mysql/mysql_error.log into your terminal window once you are connected to your server.

Have another answer? Share your knowledge.