Can't install MySQL 8 on Ubuntu 19.04

I'm using Ubuntu 19.04 and downloaded version 8.13 of MySQL APT config and ran these commands

wget https://dev.mysql.com/get/mysql-apt-config_0.8.13-1_all.deb
dpkg -i mysql-apt-config_0.8.13-1_all.deb

I checked mysql.list using

vi /etc/apt/sources.list.d/mysql.list

and found version 8 is configured. And then I ran

apt install mysql-server
apt-cache show mysql-server
apt update

But still I can't install MySQL 8. APT is still pointing to 5.7.


Solution 1:

I assume something got messed up with the apt internals and waiting 24 hours allowed everything clear and rebase itself. Where as before most - but not all - of the apt and ubuntu tools showed that mysql-8.0 was the default after doing the dpkg -i mysql-8.13 (not the actual package name).

I went back today (not quite 24 hours later) and now attempting to do the install for mysql-server shows what I expect to see:

root@mrserver:~# apt-get install mysql-server
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libmecab2 mecab-ipadic mecab-ipadic-utf8 mecab-utils mysql-client mysql-common mysql-community-client mysql-community-client-core mysql-community-server mysql-community-server-core
The following NEW packages will be installed:
  libmecab2 mecab-ipadic mecab-ipadic-utf8 mecab-utils mysql-client mysql-common mysql-community-client mysql-community-client-core mysql-community-server mysql-community-server-core mysql-server
0 upgraded, 11 newly installed, 0 to remove and 1 not upgraded.
Need to get 23.1 MB/30.1 MB of archives.
After this operation, 295 MB of additional disk space will be used.
Do you want to continue? [Y/n] 

Solution 2:

APT maintains a list of packages in /var/lib/apt/lists that would be downloaded when asked. The files in the above said folder are generally InRelease files or Release files which contains such information. According to DebianRepository/Format - Debian Wiki:

To download packages from a repository apt would download a InRelease or Release file from the $ARCHIVE_ROOT/dists/$DISTRIBUTION directory.

InRelease files are signed in-line while Release files should have an accompanying Release.gpg file.

The Release file lists the index files for the distribution and their hashes (the index file listed are relative to Release file location).

To download index of the main component apt would scan the Release file for hashes of files in the main directory. eg. http://ftp.cz.debian.org/debian/dists/testing/main/binary-i386/Packages.bz2 which would be listed in http://ftp.cz.debian.org/debian/dists/testing/main/Release as binary-i386/Packages.bz2

For MySQL, it seems the InRelease file for Disco although contains the required details but the package information in /mysql-8.0/binary-amd64/ is empty. This is the main cause of the underlying issue. This ain't the first time MySQL did such thing. An exactly similar issue happened 6 months ago, i.e. April 2019.

After looking the situation, it seems MySQL thinks that non-LTS releases are supported for 6 months or expects the users to upgrade to the latest non-LTS as soon as possible. I won't be surprised if they remove package information of 19.10 in April 2020.

However, MySQL version can still be downloaded and installed but by using either Bionic's (18.04) or Eoan's (19.10) repository information. It would install MySQL version 8.0 without breaking the system. I assume that you have already installed mysql-apt-config deb package which create mysql.list

  • If 18.04's repository information is to be used

      sudo sed -i 's/disco/bionic/g' /etc/apt/sources.list.d/mysql.list
    
  • If 19.10's repository information is to be used

      sudo sed -i 's/disco/eoan/g' /etc/apt/sources.list.d/mysql.list
    

Then finally run

sudo apt update
sudo apt install mysql-server

It's upto you if you want to keep other release's repository information. Keeping it won't harm your system as well.

Solution 3:

In the end I fixed this by updating to 19.10 and then the default mySQL installation was v 8.0 anyway.