Mariadb 10.2 install on Debian 9 - norxiva/sparrow GitHub Wiki

Here are the commands to run to add MariaDB to your system:

sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xF1656F24C74CD1D8
sudo add-apt-repository 'deb [arch=amd64] http://mirrors.tuna.tsinghua.edu.cn/mariadb/repo/10.2/debian stretch main'

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

sudo apt-get update
sudo apt-get install mariadb-server

if apt-key error like below, please install dirmngr

norxiva@debian220:~$ sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xF1656F24C74CD1D8
Executing: /tmp/apt-key-gpghome.7Z3MJl8ICc/gpg.1.sh --recv-keys --keyserver keyserver.ubuntu.com 0xF1656F24C74CD1D8
gpg: failed to start the dirmngr '/usr/bin/dirmngr': No such file or directory
gpg: connecting dirmngr at '/tmp/apt-key-gpghome.7Z3MJl8ICc/S.dirmngr' failed: No such file or directory
gpg: keyserver receive failed: No dirmngr

sudo apt install dirmngr

https://downloads.mariadb.org/mariadb/repositories/#mirror=tuna