How to Install MariaDB on Amazon Linux

Learn how to install MariaDB on Amazon Linux with this step-by-step guide. Follow the instructions to set up and configure MariaDB on your Amazon Linux instance.

Welcome to this comprehensive guide on how to install MariaDB on Amazon Linux. In this article, we will walk you through the step-by-step process of setting up and configuring MariaDB, a popular open-source relational database management system, on an Amazon Linux environment. Whether you are a beginner or an experienced developer, this guide will provide you with all the necessary information to successfully install MariaDB and start leveraging its powerful features.


Before we proceed with the installation, ensure that you have the following prerequisites in place:

  • An Amazon Linux instance with administrative privileges.
  • A stable internet connection.

Updating the System

To begin, it is essential to update the system packages and repositories. Open the terminal and execute the following commands:

sudo yum update -y
sudo yum upgrade -y

By updating the system, you ensure that you have the latest security patches and bug fixes.

Adding the MariaDB Repository

Next, we need to add the MariaDB repository to the Amazon Linux instance. This repository contains the latest version of MariaDB.

Run the following command to download and install the repository configuration package:

sudo yum install -y

Once the package is installed, enable the MariaDB repository by executing:

sudo /usr/bin/mariadb_repo_setup

Installing MariaDB

Now we are ready to install MariaDB. Run the following command to install the MariaDB server package:

sudo yum install -y MariaDB-server MariaDB-client

During the installation, you will be prompted to confirm the download and installation of the packages. Type ‘y’ and press Enter to proceed.

Configuring MariaDB

After the installation is complete, we need to configure MariaDB. Execute the following command to start the configuration process:

sudo mysql_secure_installation

This command will prompt you to set a root password, remove anonymous users, disallow remote root login, and remove the test database. Follow the on-screen instructions to configure MariaDB according to your preferences.

Securing MariaDB

To enhance the security of your MariaDB installation, we recommend implementing additional security measures. Some best practices include:

  • Creating separate user accounts with limited privileges.
  • Enabling a firewall to restrict incoming connections.
  • Regularly updating MariaDB to the latest version.

Implementing these security measures will help protect your data and prevent unauthorized access.

Verifying the Installation

To ensure that MariaDB is successfully installed and running, execute the following command in the terminal:

sudo systemctl status mariadb

If MariaDB is running, you will see an active (running) status. Additionally, you can test the installation by logging in to the MariaDB shell using the following command:

sudo mysql -u root -p

Enter your root password when prompted. If you can access the MariaDB shell, it indicates a successful installation.


Congratulations! You have successfully installed MariaDB on your Amazon Linux instance. This article guided you through the installation process, including updating the system, adding the MariaDB repository, installing MariaDB, configuring it, and verifying the installation.

Now you are ready to leverage the power of MariaDB for your database management needs. Explore the various features and functionalities offered by MariaDB, and unlock the potential of this robust relational database management system.

Happy coding!

Must Read

Related Articles