Install MariaDB 10.6 on Debian 11

Last Updated:

Follow through this guide to learn how to install MariaDB 10.6 on Debian 11. “MariaDB 10.6 is the current stable series of MariaDB. It is an evolution of MariaDB 10.5 with several entirely new features and improvements.

Installing MariaDB 10.6 on Debian 11

Run System Update

Assuming that you are installing MariaDB 10.6 on a newly installed Debian 11, update and upgrade your system packages.

apt update 
apt upgrade

There are two methods in which you can install MariaDB;

Install MariaDB 10.6 from APT Repository

MariaDB 10.5 is the currently available version on the default Debian 11 repos;

apt show mariadb-server

Package: mariadb-server
Version: 1:10.5.11-1
Priority: optional
Section: database
Source: mariadb-10.5
Maintainer: Debian MySQL Maintainers 
Installed-Size: 72.7 kB
Depends: mariadb-server-10.5 (>= 1:10.5.11-1)
Tag: devel::lang:c++, devel::lang:sql, devel::library, implemented-in::c++,
 interface::commandline, interface::daemon, network::server,
 protocol::db:mysql, role::devel-lib, role::metapackage, role::program,
Download-Size: 34.8 kB
APT-Sources: bullseye/main amd64 Packages

Therefore, to install MariaDB 10.6, you need to install MariaDB 10.6 APT repos.

Install MariaDB 10.6 APT repos on Debian 11

Execute the commands below to install MariaDB 10.6 APT repos;

apt install software-properties-common dirmngr
apt-key adv --fetch-keys ''

Next, head over to MariaDB repositories site to choose your mirrors.

Choose your Linux distro, distro release, MariaDB version to install and finally the Mirrors to use.

To use UKfast mirrors, for example, run the command below;

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

Resynchronize your package cache;

apt update

Install MariaDB 10.6;

apt install mariadb-server

Install MariaDB 10.6 using .DEB Binary Files

While this is not the recommended way of installing MariaDB, you can as well download .deb binary files and install it.

Follow the link below to learn how to install MariaDB using the .deb files.

Install MariaDB using deb binary files

Verify the MariaDB installed version

To check the version of installed MariaDB, run the command below;

mysql -V
mysql  Ver 15.1 Distrib 10.6.4-MariaDB, for debian-linux-gnu (x86_64) using readline EditLine wrapper

Running MariaDB 10.6 on Debian 11

Upon installation, MariaDB is started and enabled to run on system boot;

systemctl status mariadb

● mariadb.service - MariaDB 10.6.4 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
    Drop-In: /etc/systemd/system/mariadb.service.d
     Active: active (running) since Sat 2021-08-21 08:44:32 EAT; 5min ago
       Docs: man:mariadbd(8)
    Process: 3466 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
    Process: 3467 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
    Process: 3469 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-en>
    Process: 3529 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
    Process: 3531 ExecStartPost=/etc/mysql/debian-start (code=exited, status=0/SUCCESS)
   Main PID: 3516 (mariadbd)
     Status: "Taking your SQL requests now..."
      Tasks: 9 (limit: 1133)
     Memory: 86.2M
        CPU: 2.201s
     CGroup: /system.slice/mariadb.service
             └─3516 /usr/sbin/mariadbd

Aug 21 08:49:47 /etc/mysql/debian-start[3536]: Phase 6/7: Checking and upgrading tables
Aug 21 08:49:47 /etc/mysql/debian-start[3536]: Processing databases
Aug 21 08:49:47 /etc/mysql/debian-start[3536]: information_schema
Aug 21 08:49:47 /etc/mysql/debian-start[3536]: performance_schema
Aug 21 08:49:47 /etc/mysql/debian-start[3536]: sys
Aug 21 08:49:47 /etc/mysql/debian-start[3536]: sys.sys_config                                     OK
Aug 21 08:49:47 /etc/mysql/debian-start[3536]: Phase 7/7: Running 'FLUSH PRIVILEGES'
Aug 21 08:49:47 /etc/mysql/debian-start[3536]: OK
Aug 21 08:49:47 /etc/mysql/debian-start[4552]: Checking for insecure root accounts.
Aug 21 08:49:47 /etc/mysql/debian-start[4556]: Triggering myisam-recover for all MyISAM tables and aria-recover for all Aria tables

You can manage the service via systemctl command.

For example, to stop MariaDB service;

systemctl restart mariadb

To stop the service;

systemctl stop mariadb

Disable the service from running on system boot;

systemctl disable mariadb

Securing MariaDB 10.6

MariaDB comes with a default security script, mysql_secure_installation that is used to improve the security of MariaDB installation by:

  • Setting the password for root accounts (if need be).
  • Disabling remote root login to the databases.
  • Removing anonymous-user accounts.
  • Removing the test database, which by default can be accessed by anonymous users.

Simply run the command below to launch the script.


MariaDB Authentication

The new installations of MariaDB have two secure accounts are created during the installation.

The accounts are root@localhost and mysql@localhost.

Both accounts uses either of the unix_socket and the mysql_native_password authentication plugins.

unix_socket authentication plugin allows a system root user or a user with sudo rights to login as root@locahost to MariaDB database without a password.

With unix_socket authentication plugin, while being a root user, you can simply login by running either of the commands below;



mysql -u root

Even if you run, mysql -u root -p, and press ENTER for blank password, you will still login.

As a user with sudo rights, prefix the commands above with sudo.

Enable MariaDB password Authentication

The mysql_native_password plugin is used as a failover for the unix_socket plugin. However, the account has an invalid password. To enable password authentication, you need to login to MariaDB as root user as shown above and set the password.

set password = password("P@sSw0Rd123");
flush privileges;

This re-enables the MariaDB password authentication and hence, you can now login as non root or non sudo user.

koromicha@debian:~$ mysql -u root -p
Enter password: ENTER PASSWORD
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 57
Server version: 10.6.4-MariaDB-1:10.6.4+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)]>

Similarly, you can login as mysql user;

sudo -u mysql mysql

Set Native Password Authentication Method as Default

To completely disable unix_socket authentication plugin and instead use the msqyl_native_password authentication method, simply login to MariaDB and change the authentication plugin for root user.

ALTER USER root@localhost IDENTIFIED VIA mysql_native_password USING PASSWORD("MyPQQSSword");
flush privileges;

Next time you try to login without specifying the password, login will fail.

sudo mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

That marks the end of our guide on how to install MariaDB on Debian 11.

Other Tutorials

Install MariaDB 10.5 on FreeBSD 13

Install MariaDB 10.x on Rocky Linux 8


We're passionate about sharing our knowledge and experiences with you through our blog. If you appreciate our efforts, consider buying us a virtual coffee. Your support keeps us motivated and enables us to continually improve, ensuring that we can provide you with the best content possible. Thank you for being a coffee-fueled champion of our work!

Photo of author
I am the Co-founder of, Linux and the whole FOSS enthusiast, Linux System Admin and a Blue Teamer who loves to share technological tips and hacks with others as a way of sharing knowledge as: "In vain have you acquired knowledge if you have not imparted it to others".

Leave a Comment