0

I am getting this message :

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

hg8
  • 13,462

2 Answers2

1

Your mysql server is not running. Try to set error logging in your /etc/mysql/my.cnf in [mysqld] section : log_error = /var/log/mysql/mysql-error.log , then restart mysql and look for errors. When you fix your errors you will access your mysql.

1

Just follow the steps below and you will be able to solve your error :

  1. Install mysql-server using command sudo apt-get install mysql-server-5.5

After that , just run below commands in your terminal :

  1. sudo service mysql stop
  2. sudo /etc/init.d/apparmor reload
  3. sudo service mysql start

Now , run the command mysql -u root -p , you will successfully enter into the mysql command prompt.

Note : I too was having the same error and found this answer from can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'.

I hope this helps. :)