Question

Restarted droplet and now "Unable to establish database connection" - tried to restart mysql and says can't start

Posted November 19, 2017 3.6k views
MySQLUbuntu 16.04

Hi. I recently rebooted my droplet due to some issues with performance. Now after rebooting and restarting Nginx and PHP-FPM the website is still down. I tried to restart mySQL but I get the message “ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ’/var/run/mysqld/mysqld.sock’ (2)”

Any help would be really appreciated as the site is completely down and I’m being flooded with emails of complaint.

Kind regards

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.

×
4 answers

Thanks for you help. Unfortunately this didn’t fix things and ultimately I’ve had to restore to a snapshot to fix the issue which is unfortunate as I’ve lost a week of work :| I’m going to get some specialist database input moving forwards, lesson learned.

It seems that the MySQL server is not started or does not exist. Please check that you have installed (previously uninstalled perhaps?) MySQL server and that it is running properly. One way to check if MySQL is running is by running any of the following commands:

# ps aucx | grep mysqld
/etc/init.d/mysqld status
sudo service mysqld status

If you are running systemd systems:

sudo systemctl status mysqld.service

When I type sudo service mysql status I get the response:

mysql stop/waiting

What operating system are you in? Please type in on shell and paste back here:

cat /etc/*-release

It should not be mysql you should check because that program is the MySQL client. You need to check if the service is running. Try:

sudo service mysqld status
Submit an Answer