This tutorial will help you to install the MariaDB on Ubuntu 20.04 LTS system.


Running Ubuntu 20.04 system Login access with root or sudo privileged account

Step 1 – Setup Repository

The Default packages repositories contain old versions of the MariaDB server. So, it will be good to use the official repository, which provides the latest version of packages. First, add the package signing key to your system by running commands: Then, create a apt configuration file on your Ubuntu system. To create file run command: Add the below snippet Save file and close.

Step 2 – Install MariaDB on Ubuntu

The official MariaDB repository contains the latest version of MariaDB server packages. Once you added the package repository, run the following commands to install MariaDB server packages and required dependencies. The above command will install the MariaDB server, client tools, and other required packages on your system.

Step 3 – Post Installation Setup

MariaDB package provides a command-line utility to complete post-installation steps. This includes configuring a password for the root user and removing unnecessary databases from the default installation. To run the MariaDB post installation wizard, type: A wizard will prompt for some inputs to set up the MariaDB root user password. Secure your MariaDB installation by removing anonymous users, disabling root login from a remote host, and removing test databases. A preferred choice is to say yes (‘y’) for all the question:

Enter current password for root (enter for none): [ JUST PRESS ENTER ] Set root password? [Y/n] y New password: [ ENTER A SECURE PASSWORD ] Re-enter new password: [ CONFIRM YOUR PASSWORD ] Remove anonymous users? [Y/n] y Disallow root login remotely? [Y/n] y Remove test database and access to it? [Y/n] y Reload privilege tables now? [Y/n] y

Step 4 – Connect to MariaDB

MariaDB packages provide a command-line utility to connect database servers via the command line. Where you can completely manage your database server. To connect MariaDB server run below command on terminal: Enter the password for the root account configured in the above step.

Step 5 – Manage Mariadb Service

The latest version of Ubuntu systems uses systemd to manage services. You can use the following commands to manage the MariaDB service on your system.

Step 6 – Create Database and User (Optional)

This is an optional step for you. The below commands help you to create a database, a user, and assign privilege to the user on the database. To use the below commands, first, you must be connected to the MariaDB server via the command line.


In this tutorial, you have learned about to install MariaDB on Ubuntu Linux system. Next, you can install phpMyAdmin to administer MySQL server via web based interface.