How to Install MariaDB on Ubuntu 18.04 Bionic Beaver

Install MariaDB on Ubuntu 18.04

In this article, we will have explained the necessary steps to install MariaDB on Ubuntu 18.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 fork of well known MySQL database management server software, developed by the brains behind MySQL, it’s envisioned to remain free/open source.

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. Installing MariaDB on Ubuntu 18.04.

Install MariaDB by issuing the following command:

sudo apt install mariadb-server

Now confirm the installation by typing following:

mysql -V

After installing MariaDB in your system start it’s service using the following command:

sudo systemctl start mariadb
sudo systemctl enable mariadb

Step 3. Securing MariaDB.

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

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 on Ubuntu 18.04. I hope you find this quick tip helpful. If you have questions or suggestions, feel free to leave a comment below.