How to Install MariaDB on Ubuntu 20.04

Install MariaDB on Ubuntu 20.04

In this article, we will have explained the necessary steps to install MariaDB on Ubuntu 20.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

MariaDB is a free and open source fully compatible, relational database management system. It is commonly used as a replacement for MySQL due to its fault tolerance, speed, and scalability. It is developed by former members of MySQL team who are concerned that Oracle might turn MySQL into a closed-source product.

Install MariaDB on Ubuntu

Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.

sudo apt update
sudo apt upgrade

Step 2. Install MariaDB on Ubuntu 20.04 system.

Install the MariaDB package using following command:

sudo apt install mariadb-server

After it’s installed, MariaDB server should be automatically started. Use systemctl to check its status:

systemctl status mariadb

Step 3. Securing MariaDB database server.

After installation, we have to improve MariaDB security by typing following:

sudo mysql_secure_installation

Then enter yes/y to the following security questions:

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
    Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
    Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
    Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y

Install MariaDB on Ubuntu 20.04

To connect to the MariaDB server through the terminal we can use the MariaDB client. To log in to the MariaDB server as the root user type:

mysql -u root -p

That’s all you need to do to install MariaDB database server on Ubuntu 20.04 Focal Fossa. I hope you find this quick tip helpful. Don’t forget to share your valuable queries/suggestions in the below comment box & also drop your worthwhile feedback.