Programster's Blog

Tutorials focusing on Linux, programming, and open source

Debian 9 - Install MySQL Server

Usually, to install MySQL on a distro, you would just perform the following commands:

sudo apt update
sudo apt install mysql-server -y

You would then receive either MySQL 5.5, 5.6, or 5.7 depending on which distro you were using, but they were all versions of MySQL. However, with Debian 9, if you do this you will end up installing MariaDB 10.1 which is a drop in replacement for 5.6.

Install MySQL 5.6, 5.7, or 5.8-preview

If you really want MySQL instead of MariaDB for whatever reason, you can execute the script below to install the version you want.

cd /tmp
sudo dpkg -i mysql-apt-config_*.deb

At the popup-page, select the version you want.

Then use the following commands to install the MySQL server (it will install the version you selected).

sudo apt update
sudo apt install mysql-community-server -y