How to Install MariaDB 10.7 on Debian 11 Bullseye

MariaDB is one of the most popular open-source databases next to its originator MySQL. The original creators of MySQL developed MariaDB in response to fears that MySQL would suddenly become a paid service due to Oracle acquiring it in 2010. With its history of doing similar tactics, the developers behind MariaDB have promised to keep it open source and free from such fears as what has happened to MySQL.

MariaDB has become just as popular as MySQL with developers, with features such as advanced clustering with Galera Cluster 4, faster cache/indexes, storage engines, and features/extensions that you won’t find in MySQL.

In the following tutorial, you will learn how to install MariaDB 10.7 on Debian 11 Bullseye.


  • Recommended OS: Debian 11 Bullseye
  • User account: A user account with sudo or root access.

Update Operating System

Update your Debian operating system to make sure all existing packages are up to date:

sudo apt update && sudo apt upgrade -y

The tutorial will be using the sudo command and assuming you have sudo status.

To verify sudo status on your account:

sudo whoami

Example output showing sudo status:

[joshua@debian~]$ sudo whoami

To set up an existing or new sudo account, visit our tutorial on Adding a User to Sudoers on Debian.

To use the root account, use the following command with the root password to log in.


Install Depedencies

The first step is to install the dependencies needed for the installation.

To do this, use the following command in your terminal:

sudo apt-get install curl software-properties-common dirmngr ca-certificates apt-transport-https -y

Import MariaDB 10.7 GPG Key & Repository

To successfully install MariaDB, you will need to import the MariaDB 10.7 repository from MariaDB or the many available mirrors. The tutorial will show two options to choose from.

Option 1 – Import MariaDB 10.7 using Mirror Server

The first option to import the GPG key and repository is to use a mirror. You can set any number of mirror locations by modifying the example commands below. The only disadvantage is that they can be a few days to a week behind on any major release updates, for example, 10.6.4 to 10.6.5.

First, import the GPG key using the following command:

sudo apt-key adv --fetch-keys ''

Example output if successful:

Executing: /tmp/apt-key-gpghome.HOUXri7uzh/ --fetch-keys
gpg: requesting key from ''
gpg: key F1656F24C74CD1D8: public key "MariaDB Signing Key <>" imported
gpg: Total number processed: 1
gpg:               imported: 1

Next, run the command in your terminal to import the MariaDB 10.7 repository:

sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] bullseye main'

Note, download mirrors can be found on this page from MariaDB foundation to find a location closer to you for the repository.

Now that the key and repository are imported update the apt package manager list to reflect the new addition.

sudo apt update

Next, skip option 2 and move on to the installation part.

Option 2 – Import MariaDB 10.7 Repo using Official Bash Script

The second choice and maybe more preferred is to use the official bash script as any updates will be instant once deployed to the official repositories. Users not near their servers may face some issues, but this will not be an issue for the majority.

In your terminal, use the following command.

curl -LsS | sudo bash -s -- --mariadb-server-version=10.7 --skip-maxscale --skip-tools

Note, if the command fails, most likely, you forgot to install the curl package.

sudo apt install curl -y

Example output:

How to Install MariaDB 10.7 on Debian 11 Bullseye

Note, the maxscale and tools were skipped. You can remove these flags, but at the current moment, tools are not supported for Debian 11. Most users will not need these extras.

This shows the repository has been successfully imported. Next, refresh your APT repository listing.

sudo apt update

Install MariaDB 10.7 on Debian

To install MariaDB, you will need to install the client and the server packages. This can be done as follows:

sudo apt install mariadb-server mariadb-client

Example output:

How to Install MariaDB 10.7 on Debian 11 Bullseye

Type Y and then press the ENTER KEY to proceed with the installation.

Confirm the installation of MariaDB by checking the version and build:

mariadb --version

Example output:

mariadb  Ver 15.1 Distrib 10.7.1-MariaDB, for debian-linux-gnu (x86_64) using readline EditLine wrapper

Check MariaDB 10.7 Service Status

Now you have installed MariaDB, and you can verify the status of the database software by using the following systemctl command:

systemctl status mariadb


How to Install MariaDB 10.7 on Debian 11 Bullseye

By default, you will find MariaDB status to be activated. If not, start MariaDB, use the following command:

sudo systemctl start mariadb

To stop MariaDB:

sudo systemctl stop mariadb

To enable MariaDB on system startup:

sudo systemctl enable mariadb

To disable MariaDB on system startup:

sudo systemctl disable mariadb

To restart the MariaDB service:

sudo systemctl restart mariadb

Secure MariaDB 10.7 with Security Script

When installing MariaDB fresh, default settings are considered weak by most standards and cause concern for potentially allowing intrusion or exploiting hackers. A solution is to run the installation security script that comes with the MariaDB installation.

First, use the following command to launch the (mysql_secure_installation):

sudo mysql_secure_installation

Next, follow below:

  • Setting the password for root accounts.
  • Removing root accounts that are accessible from outside the local host.
  • Removing anonymous-user accounts.
  • Removing the test database, which by default can be accessed by anonymous users.

Note, you use (Y) to remove everything.


How to Install MariaDB 10.7 on Debian 11 Bullseye

Login to MariaDB 10.7 Instance

Now that you have completed the post-installation installation security script, login into your MariaDB database can be done using the following:

sudo mysql -u root -p

You will be prompted to enter the root password that you set in either the installation setup or post-installation security script. Once inside the MySQL service instance, you can execute the following command as a test to see it in operation.

Type the following SHOW DATABASE command:


For those new to MySQL, all commands syntax must end with “;


How to Install MariaDB 10.7 on Debian 11 Bullseye

To exit the terminal, type the following exit command:


How to Remove (Uninstall) MariaDB 10.7

If you no longer wish to use MariaDB and want to remove it in full, execute the following command:

sudo apt remove mariadb-server mariadb-client --purge

Example output:

How to Install MariaDB 10.7 on Debian 11 Bullseye

Type Y and then press the ENTER KEY to proceed with the uninstallation.

Next, remove the repositories that were added for complete removal. You may want to do this if you are switching to 10.6 or another source.

First, if you installed MariaDB 10.7 using the mirror method, use the following command with the –removal flag now added on.

sudo add-apt-repository --remove 'deb [arch=amd64,arm64,ppc64el] bullseye main'
sudo apt update

To remove the bash script repository, use the following command.

sudo rm /etc/apt/sources.list.d/mariadb.list
sudo apt update

Note that this command will remove most of the unused dependencies in the MariaDB installation to help clean up your system.

Comments and Conclusion

In the tutorial, you have learned how to install the latest version of MariaDB 10.7 on the latest stable release Debian 11 Bullseye.

Overall, it would help if you upgraded from the old stable 10.5 as it’s pretty seasoned now compared to 10.6 if you are not moving to 10.7 just yet. There are considerable advantages in performance with upgrading. If you do upgrade, make sure to always back up your database before doing so to avoid countless hours of pain and utter frustration in anything to do with database maintenance or upgrades.

Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x