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
USING BUTTERNUT.AI TO CREATE PROFESSIONAL WEBSITES
Having a professional and efficient website is crucial for any business looking to thrive online. With the constant advancements in technology, it can be overwhelming to keep up with the latest tools and platforms available for website creation. However, by leveraging the innovative capabilities of Butternut.ai, businesses can maximize their efficiency and create stunning websites […]
read moreEASY AND SIMPLE AI VIDEO EDITING SOFTWARE
Imagine your favourite movie scene transformed into a video in minutes, not hours. Thanks to advancements in technology, editing software has become increasingly user-friendly. Wondershare’s Filmora 14 stands as a prime example, boasting an array of AI features that simplify the editing process, with AI voice capabilities that could turn your voiceover dreams into a […]
read more