Today this website wasn’t working for a few hours.
My website is built with WordPress and is hosted on DigitalOcean. They were doing server maintenance — usually, that does not cause any issues but this time it did.
When I tried to access my website, I got this error:
![Wo](https://justynadorsz.com/wp-content/uploads/2021/02/Error-establishing-a-database-connection.jpg)
I found out that the issue might be that the MySQL server was turned of.
To fix that I logged in to my droplet web console and ran:
sudo netstat -plt
It showed me programs listening for connections. However, MySQL was not on the list:
![WordPress - MySQL is not working](https://justynadorsz.com/wp-content/uploads/2021/02/DigitalOcean-Wordpress-No-Mysql.jpg)
Since MySQL was not listed, it was not running. I needed to start MySQL:
sudo systemctl start mysql
To check if MySQL started I ran the netstat command again. And this time MySQL was on the list:
![WordPress - MySQL is running](https://justynadorsz.com/wp-content/uploads/2021/02/DigitalOcean-Wordpress-Start-Mysql.jpg)
That fixed the issue for me.
Leave a Reply