How to Install MariaDB 10.8 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 advanced clustering with Galera Cluster 4, faster cache/indexes, storage engines, and features/extensions that you won’t find in MySQL.

Some of the MariaDB 10.8.x Release Highlights include:

  • mysqlbinlog GTID support
  • Stored Procedures INOUT Parameters
  • Lag-free ALTER TABLE in replication
  • Descending indexes
  • InnoDB redo log improvements
  • Auto-create partition
  • JSON Histograms
  • Spider Storage Engine Improvements

In the following tutorial, you will learn how to install or upgrade MariaDB 10.8 on Debian 11 Bullseye using the command line terminal, along with some tips on how to upgrade your existing database if one exists.

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-get install curl software-properties-common dirmngr ca-certificates apt-transport-https -y

Import MariaDB 10.8 GPG Key & Repository

By default, MariaDB is not available on Debian 11 Bullseye but can be imported using the MariaDB bash script designed for Linux distributions such as Debian that are supported, given they are long-term releases.

In your terminal, use the following command.

curl -LsS | sudo bash -s -- --mariadb-server-version=10.8

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

sudo apt install curl -y

Example output:

Install, Upgrade MariaDB 10.8 on Debian 11 Bullseye

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

sudo apt update

Install/Upgrade MariaDB 10.8

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 -y

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

mariadb --version

Example output:

Install, Upgrade MariaDB 10.8 on Debian 11 Bullseye

Enable MariaDB 10.8 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


Install, Upgrade MariaDB 10.8 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

Run MariaDB 10.8 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.

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 ~]$ 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, you should use the following steps and run the tool designed to check your tables and fix any issues with the version upgrade.

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

sudo mariadb-upgrade

How to Remove (Uninstall) MariaDB 10.8

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.

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

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

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.8 on the latest stable release Debian 11 Bullseye.

Overall, MariaDB is releasing new branches quickly these days; talk is already happening about MariaDB 10.9. As of the time of this tutorial, 10.7 has just been released in full from RC status. What is the most remarkable about MariaDB how stable the new releases are for developers. MariaDB is worth checking out to start working in and for CMS users to test on non-essential servers before upgrading.


Like to get automatic updates? Follow us on one of our social media accounts!