Install MariaDB on Ubuntu 18.04 LTS

Database Ubuntu

MariaDB is an enhanced, drop-in replacement for MySQL. MariaDB can be a better choice for choice for database professionals looking for a robust, scalable, and reliable SQL server. MariaDB has a number of updated features over MySQL.

This article will help you to Install MariaDB 10.3 on Ubuntu 18.04 LTS via apt package manager.


You can find the MariaDB Apt configuration file from the official website. Import the package singin key for MaraiDB packages on your system.

After this, create a new Apt configuration file for MariaDB with the following command. You can use any text editor than vim.

Install MariaDB on Ubuntu 18.04

After adding the repository to your system and use following commands to install MariaDB-server on your Ubuntu system. This will remove any previous version of MariaDB packages and install the latest packages on the system. Make sure you have proper backups of databases before running below commands.

This will also install other required dependencies on your system.

Install Mariadb on Ubuntu 18.04

While installing MariaDB using above command installer will prompt for MariaDB root account password. Enter a strong password as below.

Setup MariaDB password Ubuntu 18.04

This will also ask for confirm password. Enter the same as above.

Verify MariaDB Setup

After successful installation of MariaDB on Ubuntu 18.04 system. The installer will also start service during the install process. You can verify service by running below command.

MariaDB also creates a reference of service with name mysql. You can change mariadb with mysql as per your choice.

You will see running status like:

MariaDB Service on Ubuntu 18.04

Then connect to MariaDB shell by running below command. You need to enter password configured in above step.

Manage MariaDB Service

Sometimes you need to stop or start MariaDB service. Use the following commands to stop, start, check status and restart MariaDB service.