0

I installed mariadb-server before installing mysql-server (which I wasn't supposed to do), so I purged mariadb* and removed it from the repos. However, I can't install mysql-server.

After sudo apt-get install mysql-server, I get:

Setting up mysql-server-5.7 (5.7.19-0ubuntu0.16.04.1) ...
invoke-rc.d: could not determine current runlevel
 * Stopping MySQL database server mysqld                                                                                                                                     [ OK ] update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Renaming removed key_buffer and myisam-recover options (if present)
invoke-rc.d: could not determine current runlevel
invoke-rc.d: could not determine current runlevel
 * Stopping MySQL database server mysqld                                                                                                                                     [ OK ] invoke-rc.d: could not determine current runlevel
mysql_upgrade: Got error: 2002: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) while connecting to the MySQL server
Upgrade process encountered error and will not continue.
mysql_upgrade failed with exit status 11
dpkg: error processing package mysql-server-5.7 (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up libhtml-tagset-perl (3.20-2) ...
Setting up liburi-perl (1.71-1) ...
Setting up libhtml-parser-perl (3.72-1) ...
Setting up libcgi-pm-perl (4.26-1) ...
Setting up libfcgi-perl (0.77-1build1) ...
Setting up libcgi-fast-perl (1:2.10-1) ...
Setting up libencode-locale-perl (1.05-1) ...
Setting up libhtml-template-perl (2.95-2) ...
Setting up libtimedate-perl (2.3000-2) ...
Setting up libhttp-date-perl (6.02-1) ...
Setting up libio-html-perl (1.001-1) ...
Setting up liblwp-mediatypes-perl (6.02-1) ...
Setting up libhttp-message-perl (6.11-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
Processing triggers for libc-bin (2.23-0ubuntu9) ...
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          Processing triggers for systemd (229-4ubuntu19) ...
Processing triggers for ureadahead (0.100.0-19) ...
Errors were encountered while processing:
 mysql-server-5.7
E: Sub-process /usr/bin/dpkg returned an error code (1)

After running sudo apt-get install -f, I get:

Setting up mysql-server-5.7 (5.7.19-0ubuntu0.16.04.1) ...
invoke-rc.d: could not determine current runlevel
 * Stopping MySQL database server mysqld                                                                                                                                     [ OK ] Renaming removed key_buffer and myisam-recover options (if present)
invoke-rc.d: could not determine current runlevel
invoke-rc.d: could not determine current runlevel
 * Stopping MySQL database server mysqld                                                                                                                                     [ OK ] invoke-rc.d: could not determine current runlevel
mysql_upgrade: Got error: 2002: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) while connecting to the MySQL server
Upgrade process encountered error and will not continue.
mysql_upgrade failed with exit status 11
dpkg: error processing package mysql-server-5.7 (--configure):
 subprocess installed post-installation script 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)

How do I get around these errors and install mysql-server?

1
  • Did you stop maria db before purging it?
    – Rinzwind
    Jul 25, 2017 at 7:13

1 Answer 1

1

It seems mariadb not removed/purged completely.

 sudo apt-get purge mariadb* 
 sudo apt-get purge mysql* 
 sudo apt-get autoremove

Remove everything in /etc/mysql directory

 rm -rf /etc/mysql/

Now insatll mysql-server

apt-get install mysql-server

If above steps still showing any error then try to reconfigure dpkg

dpkg --configure -a

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.