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

The error Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ can be caused by several things. Here are some steps to take to fix it.

1. The mysql server is not installed. 

“But wait” you say ” I just installed it”.  Most likely you did a yum install mysql If that is the case then you did install the mysql client, but not the server.

To fix the issue on fedora enter as root

yum install mysql mysql-server

or on ubuntu as root

apt-get install mysql mysql-server

You should be able to start the mysql service. There different ways to start services depending on your distribution of linux. One of these should work.

service mysqld start (notice that there is a d at the end of myqsl. Stands for mysql daemon)

or

/etc/init.d/mysql start
If you still have problems, logout or reboot and try again.

Advertisements

About spuder
spuder is a "super computer" support engineer by day, and tinkerer / hobbyist by night.

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

%d bloggers like this: