Ubuntu – After upgrading to Ubuntu 19.10, MySQL fails

MySQL

My system offered to upgrade from 19.04 so I let it but many errors. Now MySQL will not run. Running this in terminal:

Ran: sudo dpkg –remove –force-all mysql-community-client libmysqlclient21:amd64 mysql-common mysql-community-client-core

dpkg: mysql-community-client: dependency problems, but removing anyway as you requested:
 dbconfig-mysql depends on default-mysql-client | virtual-mysql-client; however:
  Package default-mysql-client is not installed.
  Package virtual-mysql-client is not installed.
  Package mysql-community-client which provides virtual-mysql-client is to be removed.

(Reading database ... 533508 files and directories currently installed.)
Removing mysql-community-client (8.0.18-1ubuntu19.10) ...
dpkg: libmysqlclient21:amd64: dependency problems, but removing anyway as you requested:
 libvtk6.3 depends on libmysqlclient21 (>= 8.0.11); however:
  Package libmysqlclient21:amd64 is to be removed.
 libsnmp30:amd64 depends on libmysqlclient21 (>= 8.0.11).
 libqt4-sql-mysql:amd64 depends on libmysqlclient21 (>= 8.0.11).
 libgdal20 depends on libmysqlclient21 (>= 8.0.11).

Removing libmysqlclient21:amd64 (8.0.18-1ubuntu19.10) ...
Removing mysql-common (8.0.18-1ubuntu19.10) ...
Removing mysql-community-client-core (8.0.18-1ubuntu19.10) ...
Processing triggers for man-db (2.8.7-3) ...
Processing triggers for libc-bin (2.30-0ubuntu2) ...

Then ran: sudo apt install -f

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... failed.
The following packages have unmet dependencies:
 dbconfig-mysql : Depends: default-mysql-client but it is not installed or
                           virtual-mysql-client
 libgdal20 : Depends: libmysqlclient21 (>= 8.0.11) but it is not installed
 libqt4-sql-mysql : Depends: libmysqlclient21 (>= 8.0.11) but it is not installed
 libsnmp30 : Depends: libmysqlclient21 (>= 8.0.11) but it is not installed
 libvtk6.3 : Depends: libmysqlclient21 (>= 8.0.11) but it is not installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
E: Unable to correct dependencies

Ran: sudo dpkg –remove –force-all dbconfig-mysql; apt-get download libmysqlclient21; sudo dpkg -i libmysqlclient21.deb; sudo apt install -f*

dpkg: dbconfig-mysql: dependency problems, but removing anyway as you requested:
 phpmyadmin depends on dbconfig-mysql | dbconfig-no-thanks | dbconfig-common (<< 2.0.0); however:
  Package dbconfig-mysql is to be removed.
  Package dbconfig-no-thanks is not installed.
  Version of dbconfig-common on system is 2.0.11ubuntu2.

(Reading database ... 533425 files and directories currently installed.)
Removing dbconfig-mysql (2.0.11ubuntu2) ...
Get:1 http://repo.mysql.com/apt/ubuntu eoan/mysql-8.0 amd64 libmysqlclient21 amd64 8.0.18-1ubuntu19.10 [1,281 kB]
Fetched 1,281 kB in 8s (152 kB/s)                                              
Selecting previously unselected package libmysqlclient21:amd64.
(Reading database ... 533424 files and directories currently installed.)
Preparing to unpack libmysqlclient21_8.0.18-1ubuntu19.10_amd64.deb ...
Unpacking libmysqlclient21:amd64 (8.0.18-1ubuntu19.10) ...
dpkg: dependency problems prevent configuration of libmysqlclient21:amd64:
 libmysqlclient21:amd64 depends on mysql-common (>= 8.0.18-1ubuntu19.10); however:
  Package mysql-common is not installed.

dpkg: error processing package libmysqlclient21:amd64 (--install):
 dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.30-0ubuntu2) ...
Errors were encountered while processing:
 libmysqlclient21:amd64
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... failed.
The following packages have unmet dependencies:
 libmysqlclient21 : Depends: mysql-common (>= 8.0.18-1ubuntu19.10)
 phpmyadmin : Depends: dbconfig-mysql but it is not installed or
                       dbconfig-no-thanks but it is not installed or
                       dbconfig-common (< 2.0.0) but 2.0.11ubuntu2 is installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
E: Unable to correct dependencies

Another error that pops up occasionally is:

Error: GDBus.Error:org.freedesktop.systemd1.UnitMasked: Unit -.mount is masked.

Best Answer

From comments:

  1. Remove MySQL related packages forcefully using dpkg:

    sudo dpkg --remove --force-all mysql-server mysql-community-client mysql-common mysql-community-client-core libmysqlclient20 libmysqlclient21 mysql-client mysql-community-server-core mysql-community-server
    
  2. Install MySQL again with APT:

    sudo apt install mysql-server
    
Related Question