One of my droplets is reporting that it cannot connect to the MySQL server. I’ve tried rebooting the droplet a couple of times but it hasn’t made any difference. If I try connecting to the database via SSH get the following error:
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)
The droplet is running LAMP on Ubuntu 12.04, and is running a single website (MediaWiki). It’s been fine since I set it up a couple of months ago. I haven’t made any changes to the MediaWiki codebase or to the MySQL database itself since I set it up (apart from adding content to the wiki), so I don’t really understand why it’s suddenly stopped working now.
Any ideas where to start? Where should I be looking re: log files etc?
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.
Click below to sign up and get $100 of credit to try our products over 60 days!
Have you been updating the software packages on your droplet, regularly? If not, execute: <br><pre>sudo apt-get update && sudo apt-get -y upgrade && sudo apt-get -y dist-upgrade && sudo apt-get -y autoremove</pre>
I had this exact same issue last week. I spent the entire day reinstalling MySql, restarting apache, checking the error logs, upgrading the droplet to a bigger one, posting questions here, contacting DO support and googling the error, but nothing helped.
<br> <br>I finally just created a snapshot of the droplet and started a new droplet form the snapshot image, then changed the DNS entry for the effected sites to the new droplet and everything worked again. I never did find out why it stopped but it hasn’t been a problem since. <br> <br>Try taking a snapshot of your droplet and creating a new droplet from that image. That won’t tell you what happened but it may get you up and running more quickly.