Vesta error 2002: Can't connect to localhost

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

Preamble

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 )

Issue

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: https://www.digitalocean.com/community/questions/vesta-control-panel-database-error-connection-failed)

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.

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