Install MariaDB 10 on Debian 10 Buster

Last Updated:

Welcome to our guide on how to install MariaDB 10 on Debian 10 Buster. As of this writing, MariaDB 10.4 is the latest stable release.

Installing MariaDB 10 on Debian 10 Buster

In this guide, we are going to install MariaDB 10.4 on Debian Buster. However, the default Debian 10 Buster repositories provides MariaDB 10.3.

apt policy mariadb-server
  Installed: (none)
  Candidate: 1:10.3.15-1
  Version table:
     1:10.3.15-1 500
        500 buster/main amd64 Packages

Therefore, to install MariaDB 10.4, you need to create MariaDB APR repo.

Create MariaDB APT Repo

Before you can create MariaDB APT repo, you need to import APT GPG signing key.

apt install gnupg2 -y
apt-key adv --recv-keys --keyserver 0xF1656F24C74CD1D8

Next, create MariaDB APT repo. To create the repo, use the add-apt-repository command. However, this command is not available by default and hence, you need to first install the software-properties-common.

apt install software-properties-common

After the installation, run the command below to create the MariaDB APT repo.

Note, you can choose a Mirror that is close to your region on MariaDB repos.

add-apt-repository 'deb [arch=amd64] buster main'

Run System Update

Once the key is imported and the repository added, update the system package cache by executing the following command:

apt update
apt upgrade

Install MariaDB 10.4 on Debian 10 Buster

To install MariaDB 10.4 server and client, run the command below;

apt install mariadb-server mariadb-client

Running MariaDB 10 on Debian 10 Buster

When installation is done, MariaDB is started and enabled to run on system reboot.

systemctl status mariadb
● mariadb.service - MariaDB 10.4.6 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 2019-07-17 13:07:56 EDT; 2min 22s ago
     Docs: man:mysqld(8)
 Main PID: 7899 (mysqld)
   Status: "Taking your SQL requests now..."
    Tasks: 32 (limit: 1150)
   Memory: 92.2M
   CGroup: /system.slice/mariadb.service
           └─7899 /usr/sbin/mysqld

Jul 17 13:07:59 debian10 /etc/mysql/debian-start[7937]: Phase 6/7: Checking and upgrading tables
Jul 17 13:07:59 debian10 /etc/mysql/debian-start[7937]: Running 'mysqlcheck' with connection arguments: --port='3306' --socket='/var/run/mysqld/mysqld.
Jul 17 13:07:59 debian10 /etc/mysql/debian-start[7937]: # Connecting to localhost...
Jul 17 13:07:59 debian10 /etc/mysql/debian-start[7937]: # Disconnecting from localhost...
Jul 17 13:07:59 debian10 /etc/mysql/debian-start[7937]: Processing databases
Jul 17 13:07:59 debian10 /etc/mysql/debian-start[7937]: information_schema
Jul 17 13:07:59 debian10 /etc/mysql/debian-start[7937]: performance_schema
Jul 17 13:07:59 debian10 /etc/mysql/debian-start[7937]: Phase 7/7: Running 'FLUSH PRIVILEGES'
Jul 17 13:07:59 debian10 /etc/mysql/debian-start[7937]: OK
Jul 17 13:07:59 debian10 /etc/mysql/debian-start[8261]: Triggering myisam-recover for all MyISAM tables and aria-recover for all Aria tables

To confirm that MariaDB 10 is enabled on Debian 10;

systemctl is-enabled mariadb

MariaDB 10.4 Authentication

By default, MariaDB 10.4 root@localhost user account comes secured. The fact that you were supposed to set and remember the password of MariaDB server root user password no longer exists.

The root@localhost user created with the ability to either use;

  • the unix_socket authentication plugin. This allows the the root@localhost user to login without a password via the local Unix socket as long as the login is attempted from a process owned by the operating system root user account.
  • use the mysql_native_password authentication plugin if unix_socket authentication plugin fails. An invalid password is however initially set and thus, you need to set the password with the usual SET PASSWORD statement before this method can work.

As a result, you can simply login to MariaDB 10.4 by just using mysql or mysql -u root.

mysql -u root
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 46
Server version: 10.4.6-MariaDB-1:10.4.6+maria~buster-log 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)]>

If you however need to set the root password, login to MariaDB as in above and execute the command below;

ALTER USER root@localhost IDENTIFIED VIA mysql_native_password USING PASSWORD("StronGP@SS");

You can now natively login as;

mysql -u root -p

To read more about MariaDB 10.4 authentications, check the Authentication for MariaDB 10.4 page.

Well, that is it on how to installing MariaDB 10.4 on Debian 10 Buster

You can check our related tutorials by following the links below;

Install MySQL 8 on FreeBSD 12

Install MySQL 8 on Debian 9

Install MySQL 8 on Fedora 30/Fedora 29

Install LEMP Stack with MySQL 8 on Fedora 30/Fedora 29

Install MariaDB 10.4 on Ubuntu 18.04/Debian 9


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