Background: I am using Ubuntu-20.04 and I needed to downgrade MySQL version from 8.0 to 5.7.
By using multiple tutorials I had not succeeded and then I installed MySQL 8.0 again but now I can not connect with MySQL 8.0.
mysql -u root -p
and got error
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
I think the reason was I had run these two commands:
sudo rm -rf /etc/mysql
sudo rm -rf /var/lib/mysql*
After reinstalling mysql 8.0 i found /etc/mysql but there is no directory like /var/lib/mysql* .
Please help me to login in mysql, I have tried a lot of solutions. If you have any question, please let me know.
Some extra Details:
usman@usman-Lenovo-V310-15ISK:~$ systemctl status mysql.service
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Sun 2021-08-22 22:46:33 PKT; 22min ago Process: 369742 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE)
Aug 22 22:46:33 usman-Lenovo-V310-15ISK systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5. Aug 22 22:46:33 usman-Lenovo-V310-15ISK systemd[1]: Stopped MySQL Community Server. Aug 22 22:46:33 usman-Lenovo-V310-15ISK systemd[1]: mysql.service: Start request repeated too quickly. Aug 22 22:46:33 usman-Lenovo-V310-15ISK systemd[1]: mysql.service: Failed with result 'exit-code'. Aug 22 22:46:33 usman-Lenovo-V310-15ISK systemd[1]: Failed to start MySQL Community Server.