Install MariaDB Ubuntu – Step-by-Step Installation Guide

· 1 min read

MariaDB is a popular open-source relational database system, often used as an alternative to MySQL. It is known for its performance, security, and compatibility. If you are working on Ubuntu and want to set up a database for your project, learning how to install MariaDB Ubuntu is a simple and effective process.

Before starting, ensure your system packages are up to date. Open the terminal and run the following command to update the package list:

sudo apt update

Once the update is complete, install MariaDB by running:

sudo apt install mariadb-server -y

This command automatically downloads and installs MariaDB along with its necessary dependencies. After installation, you can verify whether MariaDB is running by using:

sudo systemctl status mariadb

If the service is active, it means MariaDB is successfully installed on your Ubuntu system. You can now proceed to secure your database setup.

To enhance security, run the following command:

sudo mysql_secure_installation

This script helps you set a root password, remove anonymous users, disable remote root login, and delete test databases. It’s recommended to answer ‘Y’ (yes) for each prompt to ensure better protection of your database.

Once the setup is complete, you can access the MariaDB shell by entering:

sudo mysql

Inside the MariaDB prompt, you can start creating databases, managing users, and performing SQL operations. For example, you can create a new database using:

CREATE DATABASE sampledb;

After installation and configuration, MariaDB is ready to use for web applications, data storage, and other server-side operations.

MariaDB works well with popular web technologies like PHP and Python, making it a reliable choice for developers and administrators. Its installation on Ubuntu is straightforward and efficient, especially when following the proper command-line steps.

For more detailed instructions and examples, you can refer to the official guide here:
https://docs.vultr.com/how-to-install-mariadb-on-ubuntu-24-04

By following these steps, you can easily install MariaDB Ubuntu and configure it to manage your databases securely and effectively.