Score:0

Cannot run mysql on ubuntu 21.04

in flag

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?

user535733 avatar
cn flag
Your question lacks the *entire* apt output showing the actual install error. The summary (`error code (1)`) is too vague to offer useful advice. It's unclear if your question is about *installing* the software or about *running* the software once installed. Please edit your question to clarify what kind of help you seek.
mhisham avatar
in flag
the question is definitely about why I can't run my sql.
mhisham avatar
in flag
and I already have added the errors in error.log so it is obvious what causes the error
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.