I\'m getting this error
ERROR 2002 (HY000): Can\'t connect to local MySQL server through socket \'/var/run/mysqld/mysql.sock\' (2)
even though
I have the same problem and tried all the solutions posted here like :
sudo apt-get autoremove mysql-server
but unfortunately it doesn't work for me on ubuntu 16.04. To uninstall the right package you need to :
sudo apt-get remove mysql-
when you tried to autocomplete using tab
the command it will list the following package :
mysql-client mysql-client-core-5.7 mysql-server mysql-server-core-5.7 mysql-workbench mythes-en-us
mysql-client-5.7 mysql-common mysql-server-5.7 mysql-utilities mysql-workbench-data
obviously choose the mysql-server-core-5.7
so it would be :
sudo apt-get remove mysql-server-core-5.7
and now you can uninstall all mysql and reinstall again using these command from johnny's answer :
sudo apt-get remove --purge mysql*
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get install mysql-server mysql-client
Now I solved it and the Error is GONE.