How To Install MariaDB on Ubuntu 20

Install MariaDB on Ubuntu 20 Cloud Server

The popular MariaDB relational database service is a great drop-in replace for MySQL, and all of the commands you’re accustomed in MySQL should work perfectly in MariaDB. Or, if you are installing a relational database application for the first time, MariaDB is a great choice. It does all the things MySQL does just as well — it is only licensed differently. A relational database service is necessary for running popular content management systems like WordPress, Joomla, and Drupal hosting.

In this article, learn how to install MariaDB on your cloud server running Ubuntu 20. This is an ideal project for VPS as well as managed dedicated hosting and unmanaged dedicated server hosting.

For users on Ubuntu 16 or 18, this process should be the same. Please leave a comment if you experience any issues.

How To Install MariaDB on Ubuntu 20

The following commands must be run on a command prompt after you have successfully added SSH keys to your server and logged into your cloud server via SSH.

ssh root@<domain or IP address>

Be sure to replace the values “domain” or “IP address” with your actual primary domain or IP address.

All of the following commands will be run as the root user. If you are using a user account with sudo privilege you will want to append “sudo” as necessary.

First, make sure your package manager is up to date by running this command:

apt update

Install the MariaDB server:

apt install mariadb-server

Answer “yes” (Y) to the prompt to continue with the installation process. After completing this process you will be dropped back to your initial command prompt.

Start the MariaDB Service

To use MariaDB you have to start the SQL server running as a process.

Start the MariaDB service:

service mysql start

How to Check MariaDB Service Status

You can also check the status to make sure MaraDB is running from the default command prompt:

systemctl status mariadb

You should see a message informing you that the MariaDB service is running, including this line with additional information:

Active: active (running)

If everything is running as expected, you have successfully installed MariaDB on Ubuntu 20.

Recommended: Secure Your Installation

It is highly recommended that before you proceed using MariaDB that you stop to secure the installation. There is a convenient script you can run at any time which will help you take some necessary steps for security. Run this script at your standard command prompt:


You will be prompted to create a root user password, and several other questions. In general, it is safe to answer yes to all of these questions unless you are instructed otherwise.

If you don’t need cPanel, don't pay for it. Only pay for what you need with our scalable Cloud VPS Hosting.

check markCentOS, Debian, or Ubuntu check markNo Bloatware check markSSH and Root Access

Christopher Maiorana Content Writer II

Christopher Maiorana joined the InMotion community team in 2015 and regularly dispenses tips and tricks in the Support Center, Community Q&A, and the InMotion Hosting Blog.

More Articles by Christopher

Was this article helpful? Join the conversation!