Jump to content

MySQL Unable to connect [solved]


rauhka
 Share

Recommended Posts

Afternoon all - when attempting to connect with the MySQL cli i get this error

root> #] mysql

ERROR 2002: Can't connect to local MySQL server through socket'/var/lib/mysql/mysql.sock' (2)

 

I've had a look at the permissions on this directory and it appears correct (set to o: mysql g: mysql)

 

Any other thought on what could wrong?

Edited by rauhka
Link to comment
Share on other sites

root> #] mysql

ERROR 2002: Can't connect to local MySQL server through socket'/var/lib/mysql/mysql.sock' (2)

 

From the manual

 

There basically two reason why you'd get the error, either the server isn't running, or the mysql.sock (i gather from your post that's your socket name - the default is /tmp/mysqld.sock) doesn't exist anymore. This link should walk you through fixing both issues.

 

:ph34r: good luck

Link to comment
Share on other sites

Thanks guys - the server wasn't running (d'oh!) - up and going now...

 

To complete the topic

 

Checked if mysql server was set to turn on at start up

root #] chkconfig --list | grep sql
postgresql      0:off   1:off   2:off   3:off   4:off   5:off   6:off
mysql           0:off   1:off   2:off   3:off   4:off   5:off   6:off

 

And there it is not set to startup

 

Started services with

root #] /etc/init.d/mysql start

 

Tested... and working

And of course can't forget to add it too the startup script

root #] chkconfig --level 2345 mysql on

 

Is that the right run levels for it?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...