0

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.

  • The file `my.cnf` is located in the directory `/etc/mysql` so it should be `/etc/mysql/my.cnf` – Luuk Jan 30 '21 at 10:14
  • Does this answer your question? [Can't connect to local MySQL server through socket '/tmp/mysql.sock](https://stackoverflow.com/questions/16325607/cant-connect-to-local-mysql-server-through-socket-tmp-mysql-sock) – A.A Noman Jan 31 '21 at 10:01

1 Answers1

0

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