How to Install MariaDB on Ubuntu Server


MariaDB is a powerful and popular open-source relational database management system. It is a drop-in replacement for MySQL and offers enhanced features and performance improvements. In this guide, we will walk you through the steps to install MariaDB on an Ubuntu Server.

Prerequisites: Before you begin, ensure you have:

1. An Ubuntu server instance.

2. Access to a user account with sudo privileges.

3. A stable internet connection.

Step 1: Update Package Index

First, update the package index to ensure you have the latest package information.

sudo apt update

Step 2: Install MariaDB Server

Install the MariaDB server package using the following command :

sudo apt install mariadb-server

Step 3: Secure the Installation

Run the MariaDB security script to secure your installation :

sudo mysql_secure_installation

This script will guide you through several steps to improve the security of your MariaDB installation. You'll be prompted to set a root password, remove anonymous users, disallow root login remotely, remove the test database, and reload the privilege tables.

Step 4: Start MariaDB Service

If the MariaDB service is not started automatically after installation, you can start it using the following command :

sudo systemctl start mariadb

Step 5: Enable MariaDB to Start on Boot

To ensure MariaDB starts automatically when the system boots, enable it with :

sudo systemctl enable mariadb

Step 6: Access MariaDB Shell

You can now access the MariaDB shell using the following command :

sudo mysql -u root -p

Enter the root password you set during the installation process to access the MariaDB shell.

Conclusion :

You have successfully installed MariaDB on your Ubuntu Server. You can now start building and managing databases using this powerful relational database management system. If you encounter any issues during the installation process, refer to the MariaDB documentation or seek assistance from the community.