简体   繁体   中英

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' . Error after installation

Errors

After running service mysqld status in Ubuntu 20.04, I get the error:

Unit mysqld.service could not be found.

And after running sudo mysql I get:

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

Info

I've just installed MySQL with command

sudo apt-get install mysql-server .

There were no errors during installation. Reinstalling doesn't help. I've also tried to find problem in config files, but I don't have /etc/my.cnf . I am not sure, if it's ok.

systemctl start mysql does not help.

By the way, service mysql status works just alright and returns active status.

Resolved question.

  1. Delete /usr/local/mysql , /usr/local/bin/mysql , /usr/bin/mysql
  2. Reinstall MySQL by

sudo apt-get update

sudo apt-get install mysql-server

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM