Vesta error 2002: Can't connect to localhost

Posted May 19, 2015 5.5k views
MySQLWordPressLAMP StackScalingControl Panels


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:

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.

Submit an Answer
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.