Debian is a fairly popular operating system for servers. However, it is also used by a large number of people as an operating system on their desktop computer. But the two characteristics that make Debian a popular system are the stability and a large number of packages available to install. On the other hand, because of this many developers and administrators of networks and systems rely on Debian to serve their data to the rest of the users. In the case of data, there are many database handlers available in the official Debian repositories, but one MySQL is missing. In this post, you will learn how to install MySQL on Debian 10.
Why MySQL is not on the official repository?
This is due to a change of ownership and philosophy on the part of MySQL. Well, actually by the company that bought it that is Oracle. Then, a MySQL fork called MariaDB was made. There are no big differences between the two.
On the other hand, MySQL has a version dedicated to companies that add professional support. Something that still makes it powerful in the business segment. Then, we can say that although MariaDB is perfectly usable and compatible with MySQL many companies still prefer the support of this program.
In the same order of ideas, Debian has a fair community philosophy and has decided not to include MySQL by default. But we can install it without major problems. This is the goal of the post.
Install MySQL on Debian 10
If you open a terminal session and use APT to search for the MySQL package in the official repositories, you will have this screen output:
As you can see, MySQL is not available on Debian 10. But just add a repository to make it available. First, download the DEB package that adds it using wget.
:~$ wget http://repo.mysql.com/mysql-apt-config_0.8.13-1_all.deb
That package we just downloaded requires GNUPG as a dependency. Then it has to be installed.
:~$ sudo apt install gnupg
Now, you can install the package to add the MySQL repository.
:~$ sudo dpkg -i mysql-apt-config_0.8.13-1_all.deb
At the time of installing the package, we will be asked to configure the available packages and repositories. The default configuration is pretty good, so just scroll down and press OK.
In the end, you will see a screen output similar to this one.
Now, we can install MySQL on Debian 10 by running the following commands.
:~$ sudo apt update :~$ sudo apt install mysql-server
When the installation is finished, we will be asked for the new root user key. It should be strong and not shared.
Next, select the default authentication plugin:
Now, you can secure the new installation using the
As you can see in the image, there you will be asked some questions that will help to configure the new installation. This way, you can have a more secure instance.
So, MySQL is ready to work. You can check the current version.
:~$ mysql --version
So, enjoy it.
Despite having one of the largest repositories in all of Linux, Debian does not have MySQL by default. However, in this post, I have shown you how to install it without problems. All thanks to the official MySQL repository for Debian 10.
Please share this post with your friends and join our Telegram channel.