15 C
Texas
angeloma
Senior Writer and partner

How to install MySQL on Debian 10?

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

- Advertisement -

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:

1.- Search for MySQL on Debian 10
1.- Search for MySQL on Debian 10

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

2.- Download the repository packages
2.- Download the repository packages

That package we just downloaded requires GNUPG as a dependency. Then it has to be installed.

:~$ sudo apt install gnupg

3.- Install GNUPG on Debian 10
3.- Install GNUPG on Debian 10

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.

4.- Adding the MySQL repository on debian 10
4.- Adding the MySQL repository on Debian 10

In the end, you will see a screen output similar to this one.

5.- Adding the official MySQL repository
5.- Adding the official MySQL repository

Now, we can install MySQL on Debian 10 by running the following commands.

:~$ sudo apt update
:~$ sudo apt install mysql-server

6.- Install MySQL on Debian 10
6.- Install MySQL on Debian 10

When the installation is finished, we will be asked for the new root user key. It should be strong and not shared.

7.- Set the new root user password
7.- Set the new root user password

Next, select the default authentication plugin:

8.- Configuring the plugin
8.- Configuring the plugin

Now, you can secure the new installation using the mysql_secure_installation script.

9.- Using the mysql_secure_installation script
9.- Using the mysql_secure_installation script

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

10.- MySQL version
10.- MySQL version

So, enjoy it.

Conclusion

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.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article