How to Fix ERROR 2002 (HY000): Can’t Connect to Local MySQL Server

On Wednesday, I experienced trouble with my VPS hosted at Linode — the problem first began with my websites being unresponsive, though Nginx was still accepting requests. I initiated a reboot and soon after, my websites became responsive. However, IĀ receivedĀ a db connection error and discovered that I was unable to start the mySQL Server:

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)

I quickly began to troubleshoot the source of the error and after reading a dozen or so forums, I found a simple “fix” that could’ve been prevented from the beginning. The problem? I had used up all available disk space on my VPS Node, causing mySQL and other vital programs to be corrupt. I quickly deleted some files (I downloaded the 3.6GB Windows 8 Dev. Preview to my VPS the day before) and after typing “mysql service start” in the terminal, the mySQL Server was once again responding and serving requests to the few websites I own.

While the aforementioned error can be caused by several other problems with your server’s configuration and mySQL installation, I’d execute “df -h” before going through any additional trouble. If the disk space does not seem to be the root of the error above, carry on with your web search to find the culprit behind the flaw.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>