How To Install MariaDB 10.8 on Debian 11

In this article, we want to teach you How To Install MariaDB 10.8 on Debian 11.

MariaDB is a fork of the MySQL database management system. The RDBMS offers data processing capabilities for both small and enterprise tasks.

This DBMS is an improved version of MySQL. It comes with numerous inbuilt powerful features and many usabilities, security, and performance improvements that you cannot find in MySQL.

In this guide, you will learn to install the latest version of MariaDB on your Debian 11.

How To Install MariaDB 10.8 on Debian 11

To complete this guide, you must log in to your server as a non-root user with sudo privileges. To do this, you can check our guide the Initial Server Setup with Debian 11.

Set up MariaDB 10.8 on Debian 11

First, you need to update and upgrade your local package index with the following command:

sudo apt update && sudo apt upgrade -y

Then, you need to install the dependencies with the following command:

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

By default, MariaDB is not available on Debian 11. You can import it using the MariaDB bash script designed for Linux distributions such as Debian that are supported, given they are long-term releases. To do this, run the following command:

curl -LsS | sudo bash -s -- --mariadb-server-version=10.8
# [info] Checking for script prerequisites.
# [info] MariaDB Server version 10.8 is valid
# [info] Repository file successfully written to /etc/apt/sources.list.d/mariadb.list
# [info] Adding trusted package signing keys...
# [info] Running apt-get update...
# [info] Done adding trusted package signing keys

Now update your local package index again:

sudo apt update

At this point, you can use the following command to install MariaDB on your server:

sudo apt install mariadb-server mariadb-client -y

Verify your MariaDB installation by checking its version:

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

Now you need to start and enable your MariaDB service to start on boot with the following commands:

# sudo systemctl start mariadb
# sudo systemctl enable mariadb

Confirm that your MariaDB is active and running on Debian 11:

sudo systemctl status mariadb
● mariadb.service - MariaDB 10.8.3 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: >
Drop-In: /etc/systemd/system/mariadb.service.d
Active: active (running) since Thu 2022-06-23 05:38:06 EDT; 2min 54s ago
Docs: man:mariadbd(8)
Main PID: 20547 (mariadbd)
Status: "Taking your SQL requests now..."
Tasks: 10 (limit: 2340)
Memory: 208.1M
CPU: 541ms
CGroup: /system.slice/mariadb.service
└─20547 /usr/sbin/mariadbd

How To Run MariaDB Security Script

At this point that you have MariaDB installed on your server you need to secure your MariaDB by running a security script:

sudo mysql_secure_installation
Enter current password for root (enter for none): 
You already have your root account protected, so you can safely answer 'n'. 
Switch to unix_socket authentication [Y/n] n
You already have your root account protected, so you can safely answer 'n'. 
Change the root password? [Y/n] Y
New password: 
Re-enter new password: 
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y

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

Thanks for using MariaDB!

Now you can use the command below to access your MariaDB shell on Debian 11:

sudo mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 37
Server version: 10.8.3-MariaDB-1:10.8.3+maria~bullseye binary distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>

To upgrade your MariaDB you can use the command below:

mariadb-upgrade -u root -p

How To 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

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

For more information, you can visit the MariaDB Documentation page.


At this point, you learn to Install MariaDB 10.8 on Debian 11.

Hope you enjoy using it.

You may be interested in these articles on the orcacore website:

Install and Configure Varnish Cache with Apache on Debian 11

Secure Nginx with Let’s Encrypt on Debian 11

How To Install and Configure Cacti on Debian 11

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Leave a Reply

Your email address will not be published. Required fields are marked *

Stay informed and not overwhelmed, subscribe now!