0

I am trying to install mysql-server but I got this error:

$ sudo apt-get install mysql-server 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
mysql-server is already the newest version (5.7.25-0ubuntu0.18.04.2).
The following package was automatically installed and is no longer required:
  python-gi
Use 'sudo apt autoremove' to remove it.
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.
Do you want to continue? [Y/n] y
Setting up mysql-server-5.7 (5.7.25-0ubuntu0.18.04.2) ...
Renaming removed key_buffer and myisam-recover options (if present)
Checking if update is needed.
This installation of MySQL is already upgraded to 5.7.25, use --force if you still need to run mysql_upgrade
dpkg: error processing package mysql-server-5.7 (--configure):
 installed mysql-server-5.7 package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-5.7; however:
  Package mysql-server-5.7 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-5.7
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

As I understand from the error I need to make some configurations on mine dependency of mysql-server-5.7. Is it?

Kulfy
  • 17,696

2 Answers2

1

Maybe a duplicate of this question: dpkg: error processing package mysql-server (--configure)

You have subprocess installed post-installation script returned error exit status 1 , post-installation script is *.postinst file. In your case /var/lib/dpkg/info/mysql-server-5.5.postinst which run on configure step of the package installation. When it does fail, you are locked in, because even remove operation will try complete the stopped configure step tehn remove package. So open /var/lib/dpkg/info/mysql-server-5.5.postinst & manually edit it and add set -e on 2nd line to ignore any error (basically invoke-rc.d/init fails to restart the mysql service). restart it manually after. – user.dz Jul 1 '16 at 3:42

Bob
  • 401
0

It looks like installation was interrupted in an earlier attempt. You are facing the problem of broken dependencies. Since you already tried running with --force to no avail, start by purging the existing MySqL installation

sudo apt-get purge mysql-server

Then clean the leftovers. Update the system. Do a general upgrade.

sudo apt-get autoclean && sudo apt-get clean && sudo apt-get update && sudo apt-get upgrade

Now re-install

sudo apt-get install mysql-server
schartz
  • 119