ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

i am unable to understand, how to resolve this ?

  • Search is your friend. Read this – hmayag Feb 22 '16 at 8:47

Solutions for this:

#services mysql start
#/etc/init.d/mysql start

I have similar problem, when i re-installed mysql-5.7 in Ubuntu 16.04 LTS note) problem appeared after updating from Ubuntu 15 to Ubuntu 16.04, i also had to abandon my existing database. Still no help from Ubuntu. after uninstallation and

sudo apt-get --purge remove mysql
sudo apt-get autoremove

sudo rm -rf /var/lib/mysql
sudo rm -rf /etc/mysql
sudo rm -rf /var/log/mysql.*
sudo rm -rf /var/log/mysql
sudo dpkg --force-depends -P `dpkg -l |awk '/mysql/{print $2}'`

i reinstalled with:

sudo apt-get purge mysql-apt-config && sudo apt-get install mysql-server

Mysql ERROR 2002 (HY000) still remain But following suggestions solve the problem:

sudo apt-get purge dbconfig-mysql


sudo apt-get autoremove 


sudo apt-get install -f 

then finally

sudo apt-get install lamp-server^ phpmyadmin

Re-Re-Updating the Ubuntu-kernel(2x) solved the problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.