I am getting this message :
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'
Just follow the steps below and you will be able to solve your error :
sudo apt-get install mysql-server-5.5
After that , just run below commands in your terminal :
sudo service mysql stop
sudo /etc/init.d/apparmor reload
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. :)
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.
mysql
server running?