2

I have Ubuntu 20.04. mysql-server failed to install. Now, when I run sudo apt install -f I get

$ sudo apt install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up mysql-server-8.0 (8.0.20-0ubuntu0.20.04.1) ...
update-alternatives: error: alternative path /etc/mysql/mysql.cnf doesn't exist
dpkg: error processing package mysql-server-8.0 (--configure):
 installed mysql-server-8.0 package post-installation script subprocess returned error exit status 2
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-8.0; however:
  Package mysql-server-8.0 is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          Errors were encountered while processing:
 mysql-server-8.0
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

sudo dpkg ––configure –a doesn't work either. I cannot install any package.

Question is different from mysql-server-8.0 installation problem on Ubuntu 20.04 because I absolutely cannot install mysql-server. He managed to install it. And my package manager broke on installing it, so I can't install or remove anything now.

2

2 Answers 2

0

Boot the system into recovery mode and run dpkg which should repair the broken packages.

0

I managed to fix the package manager problem with solution here https://phoenixnap.com/kb/fix-sub-process-usr-bin-dpkg-returned-error-code-1

But I still cannot run mysql database

$ sudo systemctl start mysql
Failed to start mysql.service: Unit mysql.service not found.

$ sudo service mysqld start
Failed to start mysqld.service: Unit mysqld.service not found.

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

$ sudo mysql_secure_installation

Securing the MySQL server deployment.

Enter password for user root: 
Error: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
$ sudo apt install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up mysql-server-8.0 (8.0.20-0ubuntu0.20.04.1) ...
Failed to stop mysql.service: Unit mysql.service not loaded.
invoke-rc.d: initscript mysql, action "stop" failed.
MySQL has been frozen to prevent damage to your system. Please see /etc/mysql/FR
OZEN for help.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .