1

I cannot run MySQL (see below), but also am unable to remove it.

kajair@kajair-VGN-CS16G-R:~$ mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

I am running Ubuntu 14.04.

1
  • You say you can't remove it. What happens when you try?
    – TRiG
    Mar 3, 2015 at 20:10

2 Answers 2

7

Follow the below steps...So that you can easily remove mysql.I use these methods for removing mysql completely.

sudo service mysql stop  #or mysqld
sudo killall -9 mysql
sudo killall -9 mysqld
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean
sudo deluser mysql
sudo rm -rf /var/lib/mysql
sudo apt-get purge mysql-server-core-5.5
sudo apt-get purge mysql-client-core-5.5
2
  • Yeyah, this worked! I had really jacked on my mysqld install, I had the same error "can't connect to local mysql server through socket", and I had some variation of mysql, percona and mariadb all installed. I also couldn't stop mysql, even with kill -9 because it kept respawning. May 4, 2018 at 5:15
  • did not help me. I still have mysql command responding after all above.
    – PouJa
    Feb 27 at 23:01
2

I have seen a fix to the problem like this:

mkdir /var/run/mysqld

touch /var/run/mysqld/mysqld.sock

chown -R mysql /var/run/mysqld

/etc/init.d/mysql restart

You must log in to answer this question.

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