MySQL 5.7 on Ubuntu 19.04 and 19.10

Ubuntu 19.04/19.10 as default comes with MySQL 8.0 as it’s default version to work with. Projects that need to use a 5.* version might run into problems in the downgrade process. This post aims to guide the installation of MySQL 5.7 on ubuntu 19.04 and ubuntu 19.10.

After trying to set up MySQL following different sources [1][2] and fail over everyone, an alternative might be the installation via .deb packages through the official MySQL website, which is explored here.

Set up

For this approach two assumptions take place, named:

  1. Ubuntu 19 is up and running
  2. Expertise handling commands via terminal (shell)

Lastly, if previous tries to install mysql 5.7 on ubuntu have been done, follow the checklist:

  1. Remove any MySQL installation via apt-get with the command: sudo apt-get remove --purge mysql-server mysql-client mysql-common -y
  2. Remove old MySQL configuration from /etc/mysql with the command: sudo rm -rf /etc/mysql
  3. Keep the apt in a clean state with the command sudo apt-get update –fix-missing

Before installation check list

Ubuntu 19 comes with MySQL 8 as the defaul version to be installed, to double check that run the following command in the command line sudo apt list | grep mysql-server, the output should display the MySQL version current in use by apt.

mysql-server-8.0/eoan-updates,eoan-security 8.0.18-0ubuntu0.19.10.1 amd64
mysql-server-core-8.0/eoan-updates,eoan-security 8.0.18-0ubuntu0.19.10.1 amd64
mysql-server/eoan-updates,eoan-security 8.0.18-0ubuntu0.19.10.1 all

As expected, the version is 8. Even though previous references have shown how to change the MySQL via apt [1][2] in early versions of ubuntu, this approach in my experienced was not effective on ubuntu 19.*.

The explored solution might work on docker containers based on ubuntu 19.* as well.

Installing MySQL via .deb files

The first step is to download MySQL 5.7 from MySQL website [3], chose the ubuntu version and hit the download button, in the next pase hit “No thanks, just start my download”. It should the a few minutes to download the entire package.

Disclaimer: this installation process requires a GUI, for terminal only installations use the direct download solution to download the .tar file:


Once the download has been completed, the .tar file should be availble in the downlods folder (or in the folder where the wget was executed), for any standard browser installation the folder will be ~/Downloads. - For now on this is the path refered, for custom directories replace ~/Downlodas with the appropriated path.

In the terminal change the directory to where the downloaded file is located, with the command:

cd ~/Downloads

Once in the folder, unpack all the files with the tar [4] command:

tar -xvf mysql-server_5.7.28-1ubuntu19.04_amd64.deb-bundle.tar

Once the command has run, the extracted files list should contain the MySQL 5.7.* deb files:


To prevent uneeded issues, the test packages can be removed as they aren’t required to install or run MySQL server. To remove those files run the following command:

rm -rf mysql-testsuite_5.7.28-1ubuntu19.04_amd64.deb mysql-community-test_5.7.28-1ubuntu19.04_amd64.deb

The final command to execute the installation is:

dpkg -i mysql-*.deb

The command will select all files that start with mysql- that has .deb extention and will start the installation process.

Once the command has completed execution, check MySQL server status with the following command:

/etc/init.d/mysql status

Which in turn should output:

 * MySQL Community Server 5.7.28 is started

Usually the MySQL service starts by default after the installation - if this is not the case the command /etc/init.d/mysql start can be used to start the service.


Errors related due the lack of dependent packages, usually can be fixed running the command sudo apt-get update –fix-missing after the error message. Ubuntu will try to install the missing dependencies automatically.


[1] How To Install MySQL 5.7 on Ubuntu 16.04 [Online]. Available: [Accessed: 26 - Dec - 2019]

[2] How to Install MySQL 5.7 on Ubuntu 16.04 LTS [Online]. Available: [Accessed: 26 - Dec - 2019]

[3] MySQL Community Downloads [Online]. Available: [Accessed: 26 - Dec - 2019]

[4] How to open a tar file in Unix or Linux [Online]. Available: [Accessed: 26 - Dec - 2019]