Question

MySQL service not starting

  • Posted on December 15, 2013
  • quiffletAsked by quifflet

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?


Submit an answer

This textbox defaults to using Markdown to format your answer.

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

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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.