How To Set up MariaDB 10.8 on Ubuntu 20.04

In this article, we want to teach you How To Set up MariaDB 10.8 on Ubuntu 20.04.

MariaDB Server is one of the most popular database servers in the world. It’s made by the original developers of MySQL and guaranteed to stay open source.

It turns data into structured information in a wide array of applications, ranging from banking to websites. Originally designed as an enhanced, drop-in replacement for MySQL, MariaDB is used because it is fast, scalable, and robust, with a rich ecosystem of storage engines, plugins, and many other tools that make it very versatile for a wide variety of use cases.

MariaDB is developed as open-source software and as a relational database, it provides an SQL interface for accessing data. The latest versions of MariaDB also include GIS and JSON features.

How To Set up MariaDB 10.8 on Ubuntu 20.04

Before you start to install MariaDB 10.8 on Ubuntu 20.04, you need to log in to your server as a non-root user with sudo privileges. To do this, you can follow our article the Initial Server Setup with Ubuntu 20.04.

Now follow the steps below to complete this guide.

Install MariaDB 10.8 on Ubuntu 20.04

First, you need to update your local package index with the following command:

sudo apt update -y

Then, you need to install the dependencies on Ubuntu 20.04:

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

At this point, you need to import the MariaDB 10.8 GPG key and add the repository to your Ubuntu 20.04 server:

curl -LsS | sudo bash -s -- --mariadb-server-version=10.8
# [info] Checking for script prerequisites.
# [info] MariaDB Server version 10.8 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

Refresh your APT repository:

sudo apt update

At this point, you can install MariaDB with the following command:

sudo apt install mariadb-server mariadb-client

Here you can verify your MariaDB installation by checking its version:

mariadb --version
mariadb Ver 15.1 Distrib 10.8.2-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

MariaDB will start automatically on your server. To check that it is active and running on your server, run the following command:

sudo systemctl status mariadb
mariadb.service - MariaDB 10.8.2 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor prese>
Drop-In: /etc/systemd/system/mariadb.service.d
Active: active (running) since Thu 2022-03-17 10:46:13 CET; 4min 11s ago
Docs: man:mariadbd(8)
Main PID: 23779 (mariadbd)
Status: "Taking your SQL requests now..."
Tasks: 9 (limit: 2282)
Memory: 92.0M
CGroup: /system.slice/mariadb.service
└─23779 /usr/sbin/mariadbd

Also, you can enable your MariaDB service to start on boot:

sudo systemctl enable mariadb

Secure MariaDB 10.8

At this point, you can secure your MariaDB installation by running a security script.

To do this, use the following command:

sudo mysql_secure_installation

You will be asked to set a root password for your MariaDB and from there enter yes to answer other questions.

Remove MariaDB 10.08 from Ubuntu 20.04

If you no longer wish to use MariaDB and want to remove it in full, execute the following command:

sudo apt autoremove mariadb-server mariadb-client --purge -y

Note, this will remove MariaDB completely including all database data.

To remove the bash script repository, use the following command.

# sudo rm /etc/apt/sources.list.d/mariadb.list
# sudo apt update

For more information, you can visit the MariaDB Documentation Page.


At this point, you learn to Set up MariaDB 10.8 on Ubuntu 20.04.

Hope you enjoy it.

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!