0

I am getting this message :

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

3
  • What command you have used to be exact?
    – heemayl
    Commented Nov 17, 2015 at 4:43
  • mysql -u root -p Commented Nov 17, 2015 at 5:26
  • Is the mysql server running?
    – heemayl
    Commented Nov 17, 2015 at 6:17

2 Answers 2

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. :)

2
  • Thanks for your suggestion,but it didn't work. Commented Nov 18, 2015 at 4:36
  • You are getting the same error which you have mentioned in your question ? Commented Nov 18, 2015 at 4:51
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.

Not the answer you're looking for? Browse other questions tagged .