Solved: Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’

June 28, 2015   /   by Marco  / Categories :  Technology

My 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
[codesyntax lang=”php”] [/codesyntax]
  • Rebooting didn’t fix the problem
  • When trying to run “mysql” an error message came back with
    [codesyntax lang=”php”] [/codesyntax]

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:

[codesyntax lang=”php”] [/codesyntax]

Then save the file

Restart mysqld by using the following command:

[codesyntax lang=”php”] [/codesyntax]

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.

Cant connect to local MySQL server through socket

RESOURCES
Here’s a list of resources that you might find useful:

More information about innodb force recovery: Click here

 

 

DO YOU LIKE WHAT YOU'VE READ?
Join our subscription list and receive our content right in your mailbox. If you like to receive some Great deals our Freebies then subscribe now!

Our Sponsors

  • Follow us:

OTHER ARTICLES YOU MAY LIKE


HOW TO REMOVE WINDOWS 10 WELCOME SCREEN

HOW TO REMOVE WINDOWS 10 WELCOME SCREEN

Have you been getting the blue Windows 10 Welcome screen? It normally pops up after installing Windows 10 or after a Windows 10 update. I’ve been receiving a lot of questions relating to this and there are a few ways to remove it. One way it to change the settings in the registry setting but […]

read more
6 REASONS TO SYNCHRONIZE YOUR DATA

6 REASONS TO SYNCHRONIZE YOUR DATA

Technology changes and complex business requirements might compromise product data, impacting negatively on the company. Data synchronization ensures that information across the production chain is consistent. BizCaps achieves such streamlining with tools that collect data and sync it from the supplier to the consumer, increasing efficiency. Here are six reasons you require data synchronization. Increased […]

read more

Subscribe

Receive the latest news and awesome deals via email

Like our Page

site auditing tools