Install MariaDB 11 on Debian 11/Debian 10

Last Updated:

Follow through this guide to learn how to install MariaDB 11 on Debian 11/Debian 10. “MariaDB 11 is the new major release series of MariaDB. It ships with several entirely new features and improvements. However, it is good to note that as of this writing, MariaDB 11 is in active development, and preview releases are available for testing purposes. Therefore, “Do not use non-stable (non-GA) releases in production!”

Install MariaDB 11 on Debian

Installing MariaDB 11 on Debian 11/Debian 10

Run System Update

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

apt update
apt upgrade

Installing MariaDB 11 on Debian 11/Debian 10

Install MariaDB 11 from APT Repository

One of the easiest ways to install MariaDB is via the use of their MariaDB package repositories.

As of this writing, the default repos for Debian 10/Debian 11 does not provide MariaDB 11 packages.

apt show mariadb-server

Package: mariadb-server
Version: 1:10.5.19-0+deb11u2
Priority: optional
Section: database
Source: mariadb-10.5
Maintainer: Debian MySQL Maintainers 
Installed-Size: 73.7 kB
Depends: mariadb-server-10.5 (>= 1:10.5.19-0+deb11u2)
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: 35.5 kB
APT-Sources: bullseye/main amd64 Packages

Default version of MariaDB on Debian 10 is MariaDB 10.3.

Therefore, to install MariaDB 11;

  • Install MariaDB APT repository on Debian 11/Debian 10

Execute the commands below to install MariaDB 11 APT repos;

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

To Install MariaDB 11 APT repository, we will use the MariaDB package repository setup script.

The script allows you to choose the version of MariaDB you want to set the APT repositories for.

For example, to install APT repository for MariaDB 11, then execute the command below;

curl -LsS | \
sudo bash -s -- --mariadb-server-version="mariadb-11.0"

Sample script output;

# [info] Checking for script prerequisites.
# [info] MariaDB Server version 11.0 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

Installing MariaDB 11 on Debian 11/Debian 10;

You should now be able to install MariaDB 11 by running the command below;

apt install mariadb-server

Verify the MariaDB installed version

MariaDB 11 deprecates the use of mysql command line tool and replaces it with mariadb.

As much as you can still be able to use mysql command, you will get some deprecation warnings.

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

mariadb -V
mariadb from 11.0.1-MariaDB, client 15.2 for debian-linux-gnu (x86_64) using readline EditLine wrapper

Running MariaDB 11 on Debian 11/Debian 10

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

systemctl status mariadb

● mariadb.service - MariaDB 11.0.1 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 Wed 2023-05-03 09:11:48 EAT; 9min ago
       Docs: man:mariadbd(8)
    Process: 13468 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
    Process: 13469 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
    Process: 13471 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-e>
    Process: 13516 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
    Process: 13518 ExecStartPost=/etc/mysql/debian-start (code=exited, status=0/SUCCESS)
   Main PID: 13500 (mariadbd)
     Status: "Taking your SQL requests now..."
      Tasks: 8 (limit: 2341)
     Memory: 205.6M
        CPU: 502ms
     CGroup: /system.slice/mariadb.service
             └─13500 /usr/sbin/mariadbd

May 03 09:11:47 debian11 mariadbd[13500]: 2023-05-03  9:11:47 0 [Note] Plugin 'wsrep-provider' is disabled.
May 03 09:11:47 debian11 mariadbd[13500]: 2023-05-03  9:11:47 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
May 03 09:11:48 debian11 mariadbd[13500]: 2023-05-03  9:11:48 0 [Note] Server socket created on IP: ''.
May 03 09:11:48 debian11 mariadbd[13500]: 2023-05-03  9:11:48 0 [Note] InnoDB: Buffer pool(s) load completed at 230503  9:11:48
May 03 09:11:48 debian11 mariadbd[13500]: 2023-05-03  9:11:48 0 [Note] /usr/sbin/mariadbd: ready for connections.
May 03 09:11:48 debian11 mariadbd[13500]: Version: '11.0.1-MariaDB-1:11.0.1+maria~deb11'  socket: '/run/mysqld/mysqld.sock'  port: 3306 binary distribution
May 03 09:11:48 debian11 systemd[1]: Started MariaDB 11.0.1 database server.
May 03 09:11:48 debian11 /etc/mysql/debian-start[13520]: Upgrading MySQL tables if necessary.
May 03 09:11:48 debian11 /etc/mysql/debian-start[13531]: Checking for insecure root accounts.
May 03 09:11:48 debian11 /etc/mysql/debian-start[13535]: 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 start MariaDB service;

systemctl start mariadb

For example, to restart 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 11

MariaDB comes with a default security script, mariadb-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;



mariadb -u root

Even if you run, mariadb -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.

For example, you can login as mysql user;

sudo -u mysql mariadb

Enable MariaDB password Authentication

With the two privileged accounts, root@localhost and mysql@localhost, anyone with access to it can login to MariaDB.

It is not recommended to leave such user accounts with no password and all privileges, as this can pose a significant security risk to your database.

The two accounts above uses mysql_native_password plugin by default;

select User,Host,plugin from mysql.user;

| User        | Host      | plugin                |
| mariadb.sys | localhost | mysql_native_password |
| root        | localhost | mysql_native_password |
| mysql       | localhost | mysql_native_password |
3 rows in set (0.002 sec)

MariaDB [(none)]>

The mysql_native_password plugin is used as a failover for the unix_socket plugin. Even if you have setup a password using MariaDB secure installation script, you can still login as those accounts without a password.

show grants for root@localhost;

| Grants for root@localhost                                                                                                                                                 |
| GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` IDENTIFIED VIA mysql_native_password USING '*9C6C35530EE4427B07D2FA4F9E119C3915D18940' OR unix_socket WITH GRANT OPTION |
| GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION                                                                                                             |
2 rows in set (0.000 sec)

MariaDB [(none)]>
show grants for mysql@localhost;

| Grants for mysql@localhost                                                                                                               |
| GRANT ALL PRIVILEGES ON *.* TO `mysql`@`localhost` IDENTIFIED VIA mysql_native_password USING 'invalid' OR unix_socket WITH GRANT OPTION |
1 row in set (0.000 sec)

MariaDB [(none)]>

As you can see above, we had already set the password for root user using the mysql_secure_installation command. But mysql user account has invalid password.

Thus, enable password authentication.

ALTER USER root@localhost identified by 'myStr0nP@ssW0rd';
ALTER USER mysql@localhost identified by 'myStr0nP@ssW0rd2';
flush privileges;

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



sudo -u mysql mariadb

Sample output;

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

Provide a password to be able to login;

mariadb -u root -p

Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 35
Server version: 11.0.1-MariaDB-1:11.0.1+maria~deb10 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)]>

Set Native Password Authentication Method as Default

When you set the password above, it completely disables unix_socket authentication plugin and instead use the msqyl_native_password authentication method;

show grants for root@localhost;

| Grants for root@localhost                                                                                                              |
| GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION                                                                          |
2 rows in set (0.000 sec)

MariaDB [(none)]>
show grants for mysql@localhost;

| Grants for mysql@localhost                                                                                                              |
1 row in set (0.000 sec)

MariaDB [(none)]>

That marks the end of our guide on how to installing MariaDB 11 on Debian 11/Debian 10.

Other Tutorials

You can check our other MySQL/MariaDB related tutorials.


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
Linux Certified Engineer, with a passion for open-source technology and a strong understanding of Linux systems. With experience in system administration, troubleshooting, and automation, I am skilled in maintaining and optimizing Linux infrastructure.

Leave a Comment