MySQL 8.4 on Debian 11: Legacy Installation Guide
Legacy Debian 11 MySQL guide. Debian LTS ended in August 2026, and Oracle’s Bullseye MySQL 8.4 repository still lists version 8.4.0.
On this page
This page documents the former MySQL 8.4 installation procedure for Debian 11 (Bullseye). Its repository instructions are retained for reference when diagnosing existing legacy hosts; the package source is no longer current.
Repository status: Do not use the Bullseye commands below for a new or production server. Oracle’s MySQL APT repository index for Debian 11 currently lists MySQL 8.4.0-1debian11 and was last updated on October 27, 2025. Oracle has since published later MySQL 8.4 maintenance releases, including 8.4.11. Packages from this Bullseye index therefore do not include those later fixes.
Debian 11’s official LTS support also ended on August 31, 2026. Keep this page only when maintaining an existing Bullseye host, and plan to move the operating system and database to a currently supported combination. For a new installation, use our MySQL 9.7 LTS guide for Debian 13; for an existing Debian 11 server, review the Debian release lifecycle and plan an OS migration before installing a current MySQL series.
Prerequisites
Before we begin, let’s ensure that your Debian 11 system is up to date. Open a terminal and run the following commands:
sudo apt update
sudo apt upgrade
This will update your package list and upgrade any existing packages to their latest versions.
Adding the MySQL Repository
To install MySQL 8 on Debian 11, you need to add the MySQL APT repository. This repository provides up-to-date MySQL packages for Debian 11.
-
Install the
lsb-releasepackage if it’s not already installed:sudo apt install lsb-release -
Download the current MySQL APT repository configuration package. As of September 2026, the package is version
0.8.40-1:wget https://dev.mysql.com/get/mysql-apt-config_0.8.40-1_all.deb -
Install the configuration package:
sudo dpkg -i mysql-apt-config_0.8.40-1_all.debIn the configuration dialog, select MySQL Server & Cluster, then choose the
mysql-8.4-ltsseries. -
Update your package list to include the MySQL APT repository:
sudo apt update
Installing MySQL Server
Now that the MySQL repository is added, you can proceed with the installation of MySQL 8:
sudo apt install mysql-server
During the installation, you will be prompted to set the root password for MySQL. Choose a strong password and make a note of it; you will need it later.
Running the Security Script
MySQL includes a security script that helps you remove insecure defaults and improve the overall security of your installation. Run the script with the following command:
sudo mysql_secure_installation
Follow the prompts to perform the following actions:
- Set the root password.
- Remove anonymous users.
- Disallow remote root login.
- Remove test databases.
- Reload privilege tables.
Managing the MySQL Service
You can manage the MySQL service using systemd commands. Here are some common tasks:
-
To start MySQL:
sudo systemctl start mysql -
To stop MySQL:
sudo systemctl stop mysql -
To restart MySQL:
sudo systemctl restart mysql -
To enable MySQL to start on boot:
sudo systemctl enable mysql
Creating a Database and Table
Let’s create a sample database and table within MySQL:
-
Log in to the MySQL shell as the root user:
sudo mysql -u root -pEnter the root password when prompted.
-
Create a new database called
mytestdb:CREATE DATABASE mytestdb; -
Create a user and grant them full privileges on the new database:
-- MySQL 8.0.18+ returns a generated password; save it securely for the connection test. CREATE USER 'myuser'@'localhost' IDENTIFIED BY RANDOM PASSWORD; GRANT SELECT, INSERT, UPDATE, DELETE ON mytestdb.* TO 'myuser'@'localhost'; -
Exit the MySQL shell:
exit
Conclusion
Congratulations! You’ve successfully installed MySQL 8 on your Debian 11 system, secured it, and created a sample database and user. MySQL is now ready for use in your applications and websites. You can further enhance your MySQL experience by installing tools like phpMyAdmin for web-based database administration and connecting your preferred programming language to MySQL. Enjoy working with your powerful and reliable database server!
If you want to learn more about MySQL, please use our MySQL tutorials and MySQL Reference.