How to Install MariaDB 10.3 on Debian 9 / Debian 8

(: December 26, 2018)

Hello folks!. In this guide, we will cover how to install MariaDB 10.3 on Debian 9 Stretch and Debian 8 Jessie. MariaDB is an open source database server released under the General Public License version 2. As of this writing, MariaDB 10.3 is the current major stable version of MariaDB, this will be supported until May 2023. For all features of MariaDB 10.3, check features page.

For CentOS 7 and Ubuntu 18.04, check:  Install MariaDB 10.x on Ubuntu 18.04 and CentOS 7

For Ubuntu 16.04 use How to install MariaDB 10.3 on Ubuntu 16.04 LTS (Xenial){text-align:left} img{margin:0 auto 0 0}

How to Install MariaDB 10.3 on Debian 9 / Debian 8

Before you can download and install MariaDB 10.3, you need to add official MariaDB upstream repositories. This contains binary packages for MariaDB. Add it like below:

Step 1: Install dependency packages

sudo apt-get install software-properties-common dirmngr

Step 2: Add MariaDB 10.3 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-get update && sudo apt-get install mariadb-server

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

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

$ sudo  systemctl status mysql
● mariadb.service - MariaDB 10.3.8 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 Fri 2018-08-10 10:38:08 UTC; 34min ago
Docs: man:mysqld(8)
Main PID: 5468 (mysqld)
Status: "Taking your SQL requests now..."
CGroup: /system.slice/mariadb.service
└─5468 /usr/sbin/mysqld

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

[email protected]:~# mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or g.
Your MariaDB connection id is 11
Server version: 10.3.8-MariaDB-1:10.3.8+maria~stretch-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)]> select version();
| version()                                 |
| 10.3.8-MariaDB-1:10.3.8+maria~stretch-log |
1 row in set (0.000 sec)

MariaDB [(none)]> 

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 18.04 / Ubuntu 16.04 / Debian 9

That’s all. Enjoy running MariaDB 10.3 on Debian 9 / Debian 8 server.{text-align:left} img{margin:0 auto 0 0}