Solved: Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’
June 28, 2015 / by Marco / Categories : TechnologyMy VPS server experienced an issue with mySQL server and thought I’d better document how to resolve it in case it happens again.
The symptoms
- An Error message saying unable to connect to the database comes up when trying to access websites using WordPress
- Manually starting the mysqld came back with “Failed”- using the command
service mysqld restart
- Rebooting didn’t fix the problem
- When trying to run “mysql” an error message came back with
The solution
For some reason this worked for me – it may not work for you. All you have to do is run the database in recovery mode so follow these instructions:
SSH into your VPS server
Edit the my.cnf file in the folder /etc and add the following line:
innodb_force_recovery = 1
Then save the file
Restart mysqld by using the following command:
service mysqld restart
It should now work. If the server started with OK then it worked.
Go back and disable the innodb recovery by either removing the line or just adding a # at the front.
Hopefully this has fixed your issue.
More information about innodb force recovery: Click here
OTHER ARTICLES YOU MAY LIKE
BUGS IN TIKTOK WEB APP
In this article, I will discuss the bugs I have encountered while using the Tik Tok web app. When using the TikTok web app, I encountered a frustrating issue where I was unable to follow back users. This problem has persisted, leaving me with zero following despite my efforts to engage with the platform. As […]
read moreTHE BEST WOOCOMMERCE AFFILIATE AFFILIATE RETAILER PLUGIN FOR MAXIMUM PROFITS
In today’s highly competitive e-commerce landscape, leveraging the power of affiliate marketing has become a crucial strategy for online retailers to maximize their profits. And when it comes to running an efficient and lucrative affiliate program on your WooCommerce store, choosing the right plugin is paramount. The best WooCommerce affiliate retailer plugin that stands out […]
read more