How to Install MariaDB on Manjaro Linux

This guide will demonstrate how to install MariaDB on Manjaro Linux using the command-line terminal, along with first-use tips.

MariaDB stands as a robust and reliable fork of MySQL, offering a wealth of features for database management, making it a favored choice for developers and database administrators alike. Its compatibility with MySQL means that it seamlessly integrates into systems that were previously relying on MySQL, providing enhanced performance, security, and features while maintaining the ease of use MySQL is known for.

Key Highlights of MariaDB:

  • Performance: Optimized for speed and reliability, MariaDB ensures efficient data handling and processing.
  • Open Source: Freely available, allowing for customization and use in various projects without licensing fees.
  • Compatibility: Fully compatible with MySQL, facilitating a smooth transition for existing MySQL users.
  • Features: Offers a rich set of features, including but not limited to replication, clustering, and advanced storage engines.

Understanding MariaDB’s Importance:

MariaDB’s growing popularity among developers and within businesses underscores its capability to serve as the backbone for critical applications and websites. Its open-source nature not only fosters innovation but also allows for a high degree of customization, ensuring that specific database needs can be met with precision. Whether you’re developing a small project or managing large-scale databases, MariaDB provides the tools necessary to achieve your objectives efficiently.

Let’s dive into the technical aspects.

Install MariaDB on Manjaro Linux via Pacman

Update Manjaro Before MariaDB Installation

Before diving into the installation process, ensuring your Manjaro system is up to date is essential. To do this, run the following command in your terminal:

sudo pacman -Syu

Install MariaDB via Pacman Command

Now that your system is updated, you can proceed with the MariaDB installation. Manjaro keeps up with the latest releases like Arch Linux, so you’ll always have access to the most recent version. Use the following command to install MariaDB:

sudo pacman -S mariadb

After the installation is complete, initialize the database with the following command:

sudo mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql

Example output:

MariaDB database initialization successful on Manjaro Linux
MariaDB Database Initialization Success

Enable MariaDB Service on Manjaro Linux

To ensure MariaDB starts automatically at system boot and begins running immediately, use the following command:

sudo systemctl enable mariadb --now

Optionally, you can verify the MariaDB installation by checking the version and build with this command:

mariadb --version

With MariaDB enabled, you can now check the status of the database service using the following systemctl command:

systemctl status mariadb


MariaDB service running successfully on Manjaro Linux
Checking MariaDB Service Status

Run MariaDB Security Script on Manjaro Linux

After installing MariaDB on your Manjaro Linux system, it’s crucial to enhance its security to protect your data and prevent unauthorized access. The default settings of a fresh MariaDB installation may be vulnerable to intrusion or exploitation. To address these concerns, you can use the MariaDB security script to guide you through securing your installation.

Running the MariaDB Security Script

To begin, execute the mariadb-secure-installation command as follows:

sudo mariadb-secure-installation

During the execution of the security script, you will be prompted to make several security enhancements:

  1. Set root password: Define a strong password for the root user to ensure only authorized users can access the MariaDB root account.
  2. Remove remote root access: Restrict root access to the local host only, preventing unauthorized remote access attempts.
  3. Remove anonymous users: Delete anonymous user accounts which may have been created during installation.
  4. Remove test database: Eliminate the default test database, which anonymous users can access.

For each prompt, type “Y” to confirm and apply the security enhancement.

Here is an example of how the mariadb-secure-installation script output might look with the appropriate responses:

[joshua@manjaro-linx ~]$ sudo mariadb-secure-installation


In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.

You already have your root account protected, so you can safely answer 'n'.

Switch to unix_socket authentication [Y/n] Y <---- Type Y then press the ENTER KEY.
Enabled successfully!
Reloading privilege tables..
 ... Success!

You already have your root account protected, so you can safely answer 'n'.

Change the root password? [Y/n] Y <---- Type Y then press the ENTER KEY.
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] Y <---- Type Y then press the ENTER KEY.
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] Y <---- Type Y then press the ENTER KEY.
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Y <---- Type Y then press the ENTER KEY.
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Y <---- Type Y then press the ENTER KEY.
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

Run MariaDB Database Tables Upgrade Tool on Manjaro Linux (Optional)

If you have recently upgraded from a previous version of MariaDB, it is essential to check your database tables for compatibility and fix any potential issues that may have arisen during the upgrade process. MariaDB provides a handy tool for this purpose called the MariaDB Database Tables Upgrade Tool.

Using the MariaDB Database Tables Upgrade Tool

To run the MariaDB Database Tables Upgrade Tool and ensure your database tables are in good condition, execute the following command in your terminal:

sudo mariadb-upgrade

Example output (the database was already updated):

Upgrading MariaDB with existing databases on Manjaro Linux
Upgrading MariaDB with Older Databases

This command will initiate the upgrade tool, performing a series of checks and applying any necessary fixes to your database tables. The process ensures that your MariaDB installation remains stable and functional, even after an upgrade from an older version.

Managing MariaDB on Manjaro Linux

Remove (Uninstall) MariaDB

If you decide you no longer need MariaDB on your Manjaro Linux system and want to uninstall it completely, follow the instructions below.

Uninstalling MariaDB and Cleaning Up Dependencies

To remove MariaDB along with most of the unused dependencies associated with its installation, execute the following command in your terminal:

sudo pacman -R mariadb

This command will help you clean up your system by removing MariaDB and its related components, ensuring your Manjaro Linux installation remains organized and free of unnecessary clutter.


In wrapping up, this guide walked you through installing MariaDB on Manjaro Linux, stepping you through the command-line magic needed to get it up and running. We also shared some essential first-use tips to kickstart your journey with MariaDB. Remember, regular updates and a bit of customization based on your needs can go a long way in enhancing MariaDB’s performance and security

Leave a Comment

Your Mastodon Instance
Share to...