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  and fail over everyone, an alternative might be the installation via .deb packages through the official MySQL website, which is explored here.
For this approach two assumptions take place, named:
- Ubuntu 19 is up and running
- Expertise handling commands via terminal (shell)
Lastly, if previous tries to install mysql 5.7 on ubuntu have been done, follow the checklist:
- Remove any MySQL installation via apt-get with the command:
sudo apt-get remove --purge mysql-server mysql-client mysql-common -y
- Remove old MySQL configuration from
/etc/mysqlwith the command:
sudo rm -rf /etc/mysql
- 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  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 , 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:
Once in the folder, unpack all the files with the tar  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:
mysql-client_5.7.28-1ubuntu19.04_amd64.deb mysql-common_5.7.28-1ubuntu19.04_amd64.deb mysql-community-client_5.7.28-1ubuntu19.04_amd64.deb mysql-community-server_5.7.28-1ubuntu19.04_amd64.deb mysql-community-source_5.7.28-1ubuntu19.04_amd64.deb mysql-server_5.7.28-1ubuntu19.04_amd64.deb mysql-testsuite_5.7.28-1ubuntu19.04_amd64.deb mysql-community-test_5.7.28-1ubuntu19.04_amd64.deb
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:
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
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.
 How To Install MySQL 5.7 on Ubuntu 16.04 [Online]. Available: https://www.fosstechnix.com/install-mysql5-on-ubuntu. [Accessed: 26 - Dec - 2019]
 How to Install MySQL 5.7 on Ubuntu 16.04 LTS [Online]. Available: https://tecadmin.net/install-mysql-5-on-ubuntu. [Accessed: 26 - Dec - 2019]
 MySQL Community Downloads [Online]. Available: https://dev.mysql.com/downloads/mysql/5.7.html. [Accessed: 26 - Dec - 2019]
 How to open a tar file in Unix or Linux [Online]. Available: https://www.pendrivelinux.com/how-to-open-a-tar-file-in-unix-or-linux. [Accessed: 26 - Dec - 2019]