Install MySQL 8 on Debian 11

This guide will take you through how to install MySQL 8 on Debian 11.

Install MySQL 8 on Debian 11

Install MySQL APT Repository

To install MySQL 8 on Debian 11, you need to install MySQL APT repositories;

First off, download MySQL APT repository installer from the downloads page.

You can get the link and use wget command to download.


Install the repository installer;

apt install ./mysql-apt-config_0.8.18-1_all.deb

Configuring mysql-apt-config

Debian 11 is currently not supported, but repositories for Debian 10 buster can be used. Hence, select debian buster and Ok to proceed.

Next, select Ok and then Ok to proceed.

The script may prompt you to once again select the product. (Ok > Ok).

Once the repository is setup, update the system packages;

apt update

Install MySQL 8 on Debian 11

install MySQL 8 on Debian 11 by running the command below;

apt install mysql-server

Set root password

During installation, you are prompted to set the database root account password. Enter the password and re-enter to confirm.

Select Default Authentication Plugin

Use strong password encryption.

Run MySQL initial Security Script

MySQL is set to run automatically once installed.

Hence, you can run the command below to remove test databases, disallow root remote login, remove test users…


Managing MySQL service

You can start/stop/restart MySQL using the commands;

systemctl start mysql
systemctl stop mysql
systemctl restart mysql

Logging into MySQL Database

You can login to MySQL database

mysql -u root -p

Enter your root password.

You can then proceed to administer your MySQL 8 database on Debian 11.

Getting Started with MySQL

Read more on Getting Started with MySQL page.

Other Tutorials

Install MariaDB 10.6 on Debian 11

Install Nginx on Debian 11

Install Apache HTTP Server on Debian 11

Founder of|Linux Engineer|Author at

Leave a Comment