How To Install MySQL 8.0 on Debian 11

In this article, we want to teach you How To Install MySQL 8.0 on Debian 11.

MySQL is a Relational Database Management System (RDBMS).

It is written in C and C++ language and it can work on different platforms like Microsoft Windows, Oracle Solaris, AIX, Symbian, Linux, MAC OS, etc.

It is available in two editions:

  • MySQL Community Server (Open Source).
  • MySQL Enterprise Server (Proprietary).

Both of the editions share the same code base except, Enterprise Edition comes with a series of extensions that can be installed as server plugins.

In this guide, you learn to install the latest version of MySQL on Debian 11.

Steps To Install MySQL 8.0 on Debian 11

Before you start to install MySQL on Debian 11, you need to log in to your server as a non-root user with sudo privileges. To do this, you can follow our article the Initial Server Setup with Debian 11.

Now you can follow the steps below to complete this guide.

Install MySQL on Debian 11

First, you need to download the Latest MySQL Deb package from the MySQL Downloads page. To do this, run the command below:

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

Then, you need to install the package with the following command:

sudo apt install ./mysql-apt-config_*_all.deb

You will get the option to select what you want to add via the repository. You need to select MySQL Server & Cluster, then press the TAB button to select OK and hit then the Enter key.

Select MySQL 8.0

Next, you need to choose the available version of MySQL on Debian 11, here in our case it was MySQL 8.0.

choose MySQL available version Debian 11

Again Select OK and then use the TAB  to move to OK and hit the Enter key.

MySQL apt configuration on Debian 11

This will automatically configure the latest Debian repository of the Database on your Debian 11.

Note: If you want to add any additional tools using its repository or want to reconfigure it run the command below:

sudo dpkg-reconfigure mysql-apt-config

Update your local package index with the following command:

sudo apt update

Then, install MySQL on Debian 11 with the following command:

sudo apt install mysql-server

You need to enter the  password that you want to use with the MySQL server and then select the Strong authentication method:

Use strong password encryption

Manage MySQL Server

Now you can start and enable your MySQL service on Debian 11 with the command below:

sudo systemctl enable --now mysql

Verify that your MySQL service is active and running on your server with the following command:

sudo systemctl status mysql
Output
mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset:>
Active: active (running) since Thu 2022-03-10 02:51:51 EST; 16s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Main PID: 14202 (mysqld)
Status: "Server is operational"
Tasks: 38 (limit: 2340)
Memory: 358.1M
CPU: 1.093s
CGroup: /system.slice/mysql.service
└─14202 /usr/sbin/mysqld

To see your MySQL version, you can run the command below:

mysql --version
Output
mysql Ver 8.0.28 for Linux on x86_64 (MySQL Community Server - GPL)

Secure MySQL installation on Debian 11

At this point, you secure your MySQL by running the MySQL secure script:

sudo mysql_secure_installation

You will be asked to enter the root password. Also, you will be asked to set a valid password component. And you will be asked if you want to change your root password. Answer them as your wish from there type y to continue.

Conclusion

At this point, you learn to Install and Secure MySQL 8.0 on Debian 11.

Hope you enjoy it.

You may be like these articles:

How To Install MySQL on AlmaLinux 8

How To Install MySQL on Centos 7

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Leave a Reply

Stay informed and not overwhelmed, subscribe now!