How to Install MariaDB 10.6 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. Many Linux distributions include MariaDB as their default database management system due to this assurance from the developers.

MariaDB 10.6 brings several significant improvements, including improved performance, scalability, and new features such as a crash-safe replication mechanism and improved SQL compatibility. In terms of performance, MariaDB 10.6 includes several optimizations that can help to speed up database operations. For example, the new version contains several changes that can help to reduce disk IO and improve caching strategies. In addition, MariaDB 10.6 introduces a new storage engine called MyRocks, which is designed for modern hardware architectures and can provide significant performance improvements. In terms of scalability, MariaDB 10.6 includes several changes that make it easier to run large databases on multiple servers. The new version introduces sharding support, dividing databases into numerous pieces spread across multiple servers. In addition, MariaDB 10.6 includes several changes that improve the ability to replicate databases across multiple servers. Finally, regarding SQL compatibility, MariaDB 10.6 introduces several features that make it easier to port applications from other database systems. Also, the new version includes support for Oracle’s PL/SQL language and introduces a compatibility mode that can make running MySQL applications on MariaDB servers easier. As a result, MariaDB 10.6 is a significant release that includes many improvements that users of all types will welcome.

In the following tutorial, you will learn how to install or upgrade MariaDB 10.6 on Debian 11 Bullseye using the command line terminal and some tips on upgrading your existing database if needed one exists using the APT repository so you will always have the latest stable version directly to improve security and performance when releases are available.

Table of Contents

Update Debian

First, update your system to ensure all existing packages are up to date.

sudo apt update && sudo apt upgrade -y

Install Dependencies

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


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

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

Import MariaDB 10.6 GPG Key & Repository

MariaDB is default available on Debian 11 Bullseye but can be imported directly from for supported distributions such as LTS releases.

In your terminal, use the following command to import the GPG Key.

curl -fsSL | gpg --dearmor | sudo tee /usr/share/keyrings/mariadb.gpg  > /dev/null

Next, import the repository as follows.

echo deb [arch=amd64,arm64,ppc64el signed-by=/usr/share/keyrings/mariadb.gpg] bullseye main | sudo tee /etc/apt/sources.list.d/mariadb.list

Next, refresh your APT repository with the following command.

sudo apt update

Install MariaDB 10.6

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


sudo apt install mariadb-server mariadb-client -y

Note that if you have imported MariaDB 10.6, the highest version will be chosen, for example.

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

mariadb --version

Example output:

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

Enable MariaDB 10.6 Service

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

systemctl status mariadb


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


sudo systemctl start mariadb

Stop MariaDB:

sudo systemctl stop mariadb

Enable MariaDB on system startup:

sudo systemctl enable mariadb

Disable MariaDB on system startup:

sudo systemctl disable mariadb

Restart the MariaDB service:

sudo systemctl restart mariadb

Run MariaDB 10.6 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 with the MariaDB installation.

See also  How to Install Tripwire IDS on Debian 11/10

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 localhost.
  • Removing anonymous-user accounts.
  • Removing the test database, which anonymous users can access by default.

Note that you use (Y) to remove everything.


[joshua@debian-11-bullseye ~]$ sudo mariadb-secure-installation


In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.

You already have your root account protected, so you can safely answer 'n'.

Switch to unix_socket authentication [Y/n] Y <---- Type Y then press the ENTER KEY.
Enabled successfully!
Reloading privilege tables..
 ... Success!

You already have your root account protected, so you can safely answer 'n'.

Change the root password? [Y/n] Y <---- Type Y then press the ENTER KEY.
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] Y <---- Type Y then press the ENTER KEY.
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] Y <---- Type Y then press the ENTER KEY.
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Y <---- Type Y then press the ENTER KEY.
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Y <---- Type Y then press the ENTER KEY.
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

Run MariaDB Database Tables Upgrade Tool

For users who have upgraded from a previous version of MariaDB, say 10.5, you should use the following steps and run the tool designed to check your tables and fix any issues with the version upgrade.

See also  How to Install XanMod Kernel on Fedora 37/36/35

Run the following command to begin the upgrade, or check that your database tables are ok.

sudo mariadb-upgrade

Example output:


I would recommend running this command regardless. As you can see above, if it has been done already, it will state it; if not, you will get a long printout of the tables that will be checked and updated accordingly for MariaDB 10.6 compatibility.

How to Remove (Uninstall) MariaDB 10.6

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

sudo apt autoremove mariadb-server mariadb-client --purge -y

Note that this will delete MariaDB, including all database data added with the –purge flag. Do not use the purge end flag if you wish to keep the data.

Lastly, remove the repository and gpg key using the following command.

sudo rm /etc/apt/sources.list.d/mariadb.list /usr/share/keyrings/mariadb.gpg

Comments and Conclusion

As any database administrator knows, performance is essential. Whether running a simple website or a powerful e-commerce platform, your users expect fast response times and smooth operation. That’s why it’s crucial to stay up-to-date on the latest software releases, and that’s why MariaDB is worth paying attention to. The company has been releasing new branches quickly lately, and while the more minor releases are only supported for up to one year, the benefits in terms of performance may be worth upgrading for. So if you’re looking for ways to improve your database performance, keep an eye on MariaDB’s latest releases – it might just be time for an upgrade.

Not what you were looking for? Try searching for additional tutorials.

Leave a Comment