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

Comments 2 Standard

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.

Source: http://forums.theplanet.com/lofiversion/index.php/t90492.html

Advertisements

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

  1. 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. 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

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s