In this tutorial, I’ll show you how you can install MariaDB 10.4 on Debian 9 Stretch and Debian 8 Jessie. MariaDB is an open source database server released under the General Public License version 2.  It is a community-developed fork of the MySQL relational database management system built to be fast, robust and with more features.

For CentOS 7  check: How to Install MariaDB 10.4 on CentOS 7

For Ubuntu 18.04 / Ubuntu 16.04 use: How to Install MariaDB 10.4 on Ubuntu 18.04 / Ubuntu 16.04

How to Install MariaDB 10.4 on Debian 9 / Debian 8

Before you install MariaDB 10.4 on Debian 9 / Debian 8, you need to add official MariaDB upstream repositories which contain binary packages for MariaDB.

Step 1: Install dependency packages

sudo apt -y install software-properties-common dirmngr

Step 2: Add MariaDB 10.4 repository and Import GPG key

For Debian 9:

sudo apt-key adv --recv-keys --keyserver 0xF1656F24C74CD1D8
sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] stretch main'

For Debian 8:

sudo apt-key adv --recv-keys --keyserver 0xcbcb082a1bb943db
sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] jessie main'

Step 3: Install MariaDB Database Server

Once the key is imported and the repository added, you can install MariaDB with:

sudo apt update && sudo apt install mariadb-server mariadb-client

When prompted to set the root password, provide the password.

install mariadb 10.4 debian 9 debian 8 01

Confirm root password to set.

install mariadb 10.4 debian 9 debian 8 02

When done, it will finish installation and start mysql service. You can check status using:

$ systemctl status mysql
● 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 Sun 2019-07-07 10:43:37 CEST; 2min 14s ago
      Docs: man:mysqld(8)
  Main PID: 4622 (mysqld)
    Status: "Taking your SQL requests now…"
    CGroup: /system.slice/mariadb.service
            └─4622 /usr/sbin/mysqld

You can log in as well to check your database version:

$ mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 10.4.6-MariaDB-1:10.4.6+maria~stretch 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)]> SELECT VERSION();
| VERSION()                                 |
| 10.4.6-MariaDB-1:10.4.6+maria~stretch     |
1 row in set (0.001 sec)
MariaDB [(none)]> QUIT

Step 4: Install Desktop Database Management Tool

If working with MySQL command line is not your thing, then consider installing a Database Tool to help you. Check out our guide below:

Install and Configure DBeaver on Ubuntu

That’s all. Enjoy running MariaDB 10.4 on Debian 9 / Debian 8 server.

Best MySQL Learning Courses on Udemy:

The Ultimate MySQL Bootcamp: Go from SQL Beginner to Expert

SQL – MySQL for Data Analytics and Business Intelligence

MySQL, SQL and Stored Procedures from Beginner to Advanced

SQL for Beginners: Learn SQL using MySQL and Database Design

The Complete MySQL Developer Course

MySQL Database Administration: Beginner SQL Database Design

Learn Database Design with MySQL

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!

As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.


Please enter your comment!
Please enter your name here