Tuesday, August 31, 2021

Failed to start MySQL Community Server

 $ mysql

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


$ sudo service mysql start

Job for mysql.service failed. See 'systemctl status mysql.service' and 'journalctl -xn' for details.


$ sudo apt list --installed | grep mysql

mysql-client-8.0/hirsute-updates,hirsute-security,now 8.0.26-0ubuntu0.21.04.3 amd64 [installed,automatic]

mysql-client-core-8.0/hirsute-updates,hirsute-security,now 8.0.26-0ubuntu0.21.04.3 amd64 [installed,automatic]

mysql-client/hirsute-updates,hirsute-updates,hirsute-security,hirsute-security,now 8.0.26-0ubuntu0.21.04.3 all [installed]

mysql-common/hirsute,hirsute,now 5.8+1.0.5ubuntu2 all [installed,automatic]

mysql-server-8.0/hirsute-updates,hirsute-security,now 8.0.26-0ubuntu0.21.04.3 amd64 [installed]

mysql-server-core-8.0/hirsute-updates,hirsute-security,now 8.0.26-0ubuntu0.21.04.3 amd64 [installed,automatic]

mysql-server/hirsute-updates,hirsute-updates,hirsute-security,hirsute-security,now 8.0.26-0ubuntu0.21.04.3 all [installed]

mythes-en-us/hirsute,hirsute,now 1:7.1.0~rc3-3 all [installed]


$ systemctl list-unit-files


$ sudo find -xdev -name *.cnf

./etc/alternatives/my.cnf

./etc/ssl/openssl.cnf

./etc/mysql/debian.cnf

./etc/mysql/mariadb.cnf

./etc/mysql/my.cnf

./etc/mysql/mysql.cnf

./etc/mysql/conf.d/mysqldump.cnf

./etc/mysql/conf.d/mysql.cnf

./etc/mysql/mysql.conf.d/mysql.cnf

./etc/mysql/mysql.conf.d/mysqld.cnf

./usr/share/ssl-cert/ssleay.cnf

./usr/lib/shim/mok/openssl.cnf

./usr/lib/ssl/openssl.cnf

./var/lib/dpkg/alternatives/my.cnf

./var/lib/mysql/auto.cnf


sudo apt purge mysql*

sudo apt autoremove

sudo apt autoclean // OPTIONAL

sudo apt dist-upgrade // OPTIONAL

sudo rm -rf /etc/mysql // OPTIONAL

sudo rm -rf /var/lib/mysql* // OPTIONAL

sudo shutdown -r now // DO NOT FORGET TO REBOOT


sudo apt install mysql-server


$ systemctl status mysql

mysql.service - MySQL Community Server

     Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)

     Active: active (running) since Tue 2021-08-31 20:23:42 EEST; 9min ago

    Process: 3163 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)

   Main PID: 3171 (mysqld)

     Status: "Server is operational"

      Tasks: 38 (limit: 19012)

     Memory: 353.4M

     CGroup: /system.slice/mysql.service

             └─3171 /usr/sbin/mysqld


сер 31 20:23:41 X370 systemd[1]: Starting MySQL Community Server...

сер 31 20:23:42 X370 systemd[1]: Started MySQL Community Server.


$ mysql

ERROR 1045 (28000): Access denied for user 'user'@'localhost' (using password: NO)


$ sudo mysql

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 12

Server version: 8.0.26-0ubuntu0.21.04.3 (Ubuntu)


Copyright (c) 2000, 2021, Oracle and/or its affiliates.


Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.


Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


mysql>

Ошибка «ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/run/mysqld/mysqld.sock’ (2 «No such file or directory»)» (РЕШЕНО)

No comments:

Post a Comment