Today, after found out that all our sites are down with a message “Error establishing a database connection“, we went to our cpanel to see what was wrong. At Cpanel, we tried to go to myphpAdmin or mySQL Database at the Database section, but it was unsuccessful. We kept trying trying trying again and again many times, but it didn’t work. It kept saying/popping up a message as the following.
The MySQL server is currently offline.
Error while connecting to MySQL: Cpanel::DBI::Mysql connect(”,’root’,…) failed: Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2) at /usr/local/cpanel/Cpanel/MysqlUtils/Connect.pm line 156. Error while connecting to MySQL: Cpanel::DBI::Mysql connect(”,’root’,…) failed: Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2) at /usr/local/cpanel/Cpanel/MysqlUtils/Connect.pm line 156.
We spent a plenty of time to find a solution around the web, but we didn’t get any luck, even through, sending a message to the hosting supporters. After many hours without answer and all sites are down at least 1/2 day. We didn’t really know exactly how long the sites had been down until noon today. We’re frustrated and didn’t know what else to do. Finally, we took a risk by touching our WHM. We’re kind a scare messing up our server but, at this time, we had no choice, doing it or waiting for an answer. As you know, there were no direct answer most of the time because we didn’t sign up for some kind of technical assistant which costs several hundred dollars. No matter what, we had to find the answer our own. That made us strongly going touching WHM.
Here is how to fix it in WHM.
- Login WHM VPS Optimized
- Go to Restart Services. That’s located on left handside column.
- Click on SQL Server (MySQL).
- Response to the prompt which popped up on the right side by saying something like are you sure to restart SQL; Yes or No. Choose Yes
- Wait until seeing “mysql started successfully.” at the end of the prompt.
That’s it. That was all we tried. After the script was stop with the message “mysql started successfully” at the bottom of the page. We went to check our sites; all them were up.