How do I install MySQL on Debian 11?

How do I install MySQL on Debian 11? That's a good question, and one that this article will answer. Although we often come across MariaDB, a fork of MySQL, the MySQL package itself remains one of the most widely used database software packages. In some cases, the application you want to install requires MySQL to be in place. I'm sure that's why you're reading this tutorial.

On a machine Debian 11Here's how to install MySQL 8 as a community edition. This procedure works on a physical server or virtual machine, including in the Cloud (AWS, Google, Azure, OVH, etc.) with a VPS or dedicated server.

As far as prerequisites are concerned, you must have "root" access to the server or have the necessary authorizations via " sudo" .

1. Updating the Debian 11 package cache

Start by updating the package index and your machine's packages to the latest available version using the following commands:

sudo apt update
sudo apt upgrade

Next, install the wget package, which will be needed for the rest of this tutorial to download the MySQL DEB package.

sudo apt install wget

Once wget has been updated and installed, you can start theinstalling MySQL on Debian 11.

2. Install MySQL

To add the MySQL repository to your system, go to the download page on the official MySQL website to download the latest DEB package: Download the DEB package. On this page, click on " Download "then retrieve the link under the ink". No thanks, just start my download." .

From your Debian server, download the :

wget https://dev.mysql.com/get/mysql-apt-config_0.8.22-1_all.deb

Install the :

sudo apt-get install ./mysql-apt-config_0.8.22-1_all.deb

With this procedure, we're going to install the latest MySQL 8.X. When you launch the installation, a window with a blue background will appear: select OK by pressing " ". Tab and press " ". Input" .

You can now install MySQL using the APT package manager. First, update the package cache, then install " mysql-server " :

sudo apt-get update
sudo apt-get install mysql-server

You'll need to set the root password for this MySQL instance.

Installing MySQL on Debian 11

Once installation is complete, the MySQL service starts automatically. To check that this is the case, which is preferable for the first startup, run this command :

sudo systemctl mysql status

The output should show that the service is activated and running:

3. MySQL database security

MySQL, like MariaDB (unsurprisingly), comes with a security script that I recommend you run, as it's really the security basics for a MySQL instance. This script is called mysql_secure_installation. Run this script :

sudo mysql_secure_installation

First, you'll be asked to configure the " VALIDATE PASSWORD "which is used to test the strength of MySQL user passwords to avoid weak passwords. Press "y" if you want to configure this function, which is recommended.

Next, you need to choose a level of requirement between low, medium and high.

LOW Length >= 8
MEDIUM Length >= 8, numeric, lowercase, uppercase and special characters
FORT Length >= 8, numeric, lowercase, uppercase and special characters and dictionary (file)

The choice depends on your security policy. Next, you'll be asked to set a new password for the MySQL root user. The strength of the password is indicated by a score (if the VALIDATE PASSWORD plugin is active).

Next, you are prompted to disable anonymous access, restrict root access to the local machine only, delete the test database and reload the privilege table. Let's keep it simple: for strengthen the security of your MySQL instanceanswer "y" to all these questions.

Thanks to this new article in the tutorial box, you can now install MySQL on your Debian 11 server (or another version).

You may also like...

No Responses

  1. Bernard says:

    Hello, thank you for this article.It's a clear and practical guide, perfect for anyone managing an univirtual vps server, dedicated server or even a private server. As a system administrator, I find this type of tutorial indispensable for maintaining a robust and secure server infrastructure. "Updating the Debian 11 package cache. This is an essential step to ensure that all installations are done with the most recent versions of software. Whether on a vps server or a dedicated univirtual server, keeping packages up to date is crucial to avoid security vulnerabilities and guarantee system stability.MySQL installation, explained in the second step, is presented in a concise and easy-to-follow manner. MySQL is a popular choice for database management, and knowing how to install it correctly on a private server or a univirtual vps server means you can manage data efficiently and reliably. The flexibility offered by vps servers and dedicated servers means that MySQL configurations can be adjusted to the specific needs of each project.Finally, the section on MySQL database security is particularly appreciated. Security is a major concern for any server administrator, whether it's a private server, a vps server or a dedicated server. dedicated server . Tips on securing MySQL, such as changing default passwords and removing anonymous users, are essential practices for protecting data from unauthorized access.

Leave a Reply

Your email address will not be published. Required fields are marked *