MySQL FIX: connect to server at ‘localhost’ failed error: ‘Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’

In short the error means that mysql isn’t running. So the next reason is, why?

Recently I upgraded from php4 to php5 on one of my servers. Ever since then any time mysql does a restart I was getting this connection error. When the job went to restart it was failing and I’d be stuck  going in and starting it myself. Sooo, the way to fix it is to open your etc/my.conf file and comment out basedir=/var/lib.


You may also like...

2 Responses

  1. Ray Noel says:

    Thank you, thank you, thank you, you are the BEST!

    I’ve been struggling with multiple other supposed solutions that did nothing to help me for many hours today.

    And such a simple fix too. Three cheers for the KISS principle AND the beautiful person that has been of such great help to me today.

  2. Jade says:

    You’re welcome!! It drove me nuts too and then I couldn’t find any decent explanations so I posted my own 🙂

Leave a Reply