Ubuntu – Install thesql-server 5.7 instead of thesql-server 8.0 on an ubuntu 19.10 machine

installationMySQLUbuntu

I have some trouble installing mysql-server 5.7 on ubuntu 19.10 (eoan) machine. Unfortunately I'm bound to mysql-server version 5.6/5.7 so just installing mysql-server 8.0 is no option.

According to earlier attempts on earlier ubuntu versions I added the mysql repository for mysql-server 5.7. This results in:

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

### THIS FILE IS AUTOMATICALLY CONFIGURED ###
# You may comment out entries below, but any other modifications may be lost.
# Use command 'dpkg-reconfigure mysql-apt-config' as root for modifications.
deb http://repo.mysql.com/apt/ubuntu/ bionic mysql-apt-config
deb http://repo.mysql.com/apt/ubuntu/ bionic mysql-5.7
deb http://repo.mysql.com/apt/ubuntu/ bionic mysql-tools
# deb http://repo.mysql.com/apt/ubuntu/ bionic mysql-tools-preview
deb-src http://repo.mysql.com/apt/ubuntu/ bionic mysql-5.7

After doing this I run the command(s) below.

sudo apt update

....
Hit:1 http://repo.mysql.com/apt/ubuntu bionic InRelease
....

after updating all the repos on my machine I run the command to install the mysql-server 5.7.

sudo apt install mysql-server

.....
The following additional packages will be installed:
mysql-client-8.0 mysql-client-core-8.0 mysql-server-8.0 mysql-server-core-8.0

As you can see from the output above ubuntu is still trying to install the mysql-server 8.0 version. This is NOT what I need.

I also tried to install mysql-server 5.7 manually by downloading the .deb files but this resulted in an dependency chaos which where unable to install.

Below I listed the content of /etc/apt/sources.list, I installed Ubuntu 19.10 by doing a serie of dist-upgrades commands. (as you can see from the lines that are commented out.)

TL;DR

I am unable to install mysql-server 5.7 at a ubuntu 19.10 machine (installed 19.10 by doing a serie of dist upgrade commands.). I added mysql 5.7 repo and ran the update command, still no luck. Ubuntu still tries to install mysql-server 8.0.

Does anybody have a suggestion to prevent mysql-server 8.0 from being installed and install mysql 5.7 instead (I am required to install mysql 5.6/5.7 I cannot use mysql-server 8.0)

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://nl.archive.ubuntu.com/ubuntu/ eoan main restricted
# deb-src http://nl.archive.ubuntu.com/ubuntu/ artful main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://nl.archive.ubuntu.com/ubuntu/ eoan-updates main restricted
# deb-src http://nl.archive.ubuntu.com/ubuntu/ artful-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://nl.archive.ubuntu.com/ubuntu/ eoan universe
# deb-src http://nl.archive.ubuntu.com/ubuntu/ artful universe
deb http://nl.archive.ubuntu.com/ubuntu/ eoan-updates universe
# deb-src http://nl.archive.ubuntu.com/ubuntu/ artful-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
## team, and may not be under a free licence. Please satisfy yourself as to 
## your rights to use the software. Also, please note that software in 
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://nl.archive.ubuntu.com/ubuntu/ eoan multiverse
# deb-src http://nl.archive.ubuntu.com/ubuntu/ artful multiverse
deb http://nl.archive.ubuntu.com/ubuntu/ eoan-updates multiverse
# deb-src http://nl.archive.ubuntu.com/ubuntu/ artful-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://nl.archive.ubuntu.com/ubuntu/ eoan-backports main restricted universe multiverse
# deb-src http://nl.archive.ubuntu.com/ubuntu/ artful-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu artful partner
# deb-src http://archive.canonical.com/ubuntu artful partner

deb http://security.ubuntu.com/ubuntu eoan-security main restricted
# deb-src http://security.ubuntu.com/ubuntu artful-security main restricted
deb http://security.ubuntu.com/ubuntu eoan-security universe
# deb-src http://security.ubuntu.com/ubuntu artful-security universe
deb http://security.ubuntu.com/ubuntu eoan-security multiverse
# deb-src http://security.ubuntu.com/ubuntu artful-security multiverse

Best Answer

I found the following solution to install mysql-server 5.7 on ubuntu 19.10.

  1. configure apt to include the mysql repository for mysql 5.7, see: mysql-apt-config_0.8.12-1_all.deb, you can follow the same instructions found here: MySQL APT repository configuration, make sure when running mysql-apt-config-0.8.12-1_all.deb you select the MySQL 5.7 version.

  2. Make sure to run sudo apt update. after running this command run the command: sudo apt policy mysql-server.

The output should look very similar to the output listed below:

  Installed: None
  Candidate: 8.0.17-0ubuntu2
  Version table:
     8.0.17-0ubuntu2 500
        500 http://nl.archive.ubuntu.com/ubuntu eoan/main amd64 Packages
        500 http://nl.archive.ubuntu.com/ubuntu eoan/main i386 Packages
     5.7.28-1ubuntu18.04 500
        500 http://repo.mysql.com/apt/ubuntu bionic/mysql-5.7 amd64 Packages
        100 /var/lib/dpkg/status

The output below is now listing two versions of the mysql-server package. The default candidate version for ubuntu 19.10 is mysql-server 8.0.17-0ubuntu2.

The second package is the package from the newly added repository above. for me, this is mysql-server 5.7.28-1ubuntu18.04

  1. To install another version of the mysql-server package (other than the default candidate) I run the following command:

sudo apt install mysql-server=<version-tag>

Example:

sudo apt install mysql-server=5.7.28-1ubuntu18.04

First, this raised a dependency issue for the package mysql-client, but I fixed this by following the same instructions from step 2 for the mysql-client package.

Related Question