I am having a hard time running mysql on ubuntu 21.04.
I tried:
sudo apt remove --purge mysql-server
sudo apt purge mysql-server
sudo apt autoremove
sudo apt autoclean
and
sudo systemctl stop mysql
sudo apt purge mysql-server mysql-client mysql-common mysql-server-core-* mysql-client-core-*
sudo rm -rf /etc/mysql /var/lib/mysql /var/log/mysql
sudo apt autoremove
sudo apt autoclean
before reinstalling mysql-server with:
sudo apt update
sudo apt install mysql-server
but to no avail.
The problem is that when I install I get this in the terminal:
Errors were encountered while processing:
mysql-server-8.0
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
and when I run sudo mysql
, I get this error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
and when I run systemctl status mysql
I get:
mysql.service - MySQL Community Server
Loaded: error (Reason: Unit mysql.service failed to load properly: Device or resource busy.)
Active: failed (Result: exit-code) since Sun 2021-09-05 23:29:27 EET; 58min ago
Main PID: 31191 (code=exited, status=1/FAILURE)
Status: "Server startup in progress"
I tried:
sudo systemctl stop mysql
sudo systemctl start mysql
but I get
Failed to start mysql.service: Unit mysql.service failed to load properly: Device or resource busy.
See system logs and 'systemctl status mysql.service' for details.
in error.log I get:
2021-09-05T22:26:37.674376Z 0 [ERROR] [MY-010262] [Server] Can't start
server: Bind on TCP/IP port: Address already in use
2021-09-05T22:26:37.674517Z 0 [ERROR] [MY-010257] [Server] Do you
already have another mysqld server running on port: 3306 ?
2021-09-05T22:26:37.674808Z 0 [ERROR] [MY-010119] [Server] Aborting
But when I run netstat -lp | grep 3306
I see that nothing is running on port 3306. And I reassure that by running sudo kill -9 $(sudo lsof -t -i:3306)
Any Idea on how to solve this?