How to Install MariaDB on Manjaro Linux

MariaDB is a popular open-source relational database management system (RDBMS) that has gained widespread adoption due to its performance, scalability, and flexibility. It is a community-driven fork of the MySQL project and is developed, maintained, and supported by the MariaDB Foundation.

Key Features and Differences between MariaDB and MySQL

  1. Open-Source and Community-Driven: MariaDB is developed under an open-source license, allowing free usage, modification, and distribution. The community-driven development process ensures that the software evolves to meet the needs of its users.
  2. Compatibility: MariaDB is designed to be compatible with MySQL. This means that existing MySQL applications, connectors, and tools can be used with MariaDB without significant changes.
  3. Performance and Scalability: MariaDB is known for its enhanced performance and scalability features, making it suitable for various applications, from small-scale projects to large-scale enterprise deployments.
  4. Storage Engines: MariaDB supports a variety of storage engines, including the default InnoDB, as well as its own developed storage engine called Aria. This allows users to choose the best storage engine for their specific use case and optimize performance.
  5. Security: MariaDB offers advanced security features, such as role-based access control, data-at-rest encryption, and plugin-based authentication.
  6. Active Development and Support: The MariaDB Foundation and the community actively develop and support MariaDB, ensuring the database stays up-to-date and secure.

By the end of this article, you will have a solid understanding of MariaDB’s capabilities and benefits and the necessary steps to install and configure it on Manjaro Linux.

MariaDB vs MySQL: What is the difference?

MariaDB and MySQL are both widely-used, open-source relational database management systems. Although MariaDB is a fork of MySQL, they have diverged over time, with each offering distinct features and benefits. In this section, we will compare these two database systems for users that may have been using MySQL previously wanting to migrate to MariaDB.

  1. Licensing and Development Model: MySQL is owned by Oracle Corporation and is available under a dual licensing model, which includes a commercial license and the GNU General Public License (GPL). MariaDB, on the other hand, is developed and maintained by the MariaDB Foundation and is released under the GPL. This means that MariaDB is completely open-source, and its development is more community-driven, making it more attractive to some users who prioritize transparency and collaboration.
  2. Compatibility: MariaDB is designed to be a drop-in replacement for MySQL, with most of its functionality compatible with MySQL. However, as the two systems have evolved, some differences and incompatibilities have emerged. While most applications, tools, and connectors that work with MySQL can be used with MariaDB, it is essential to thoroughly test your specific application for compatibility before switching.
  3. Performance: Both MariaDB and MySQL are known for their performance capabilities. MariaDB has introduced several performance optimizations, such as improved query optimization, better thread pool management, and enhanced storage engines like Aria. However, MySQL has also made performance improvements in recent releases, particularly with the introduction of the InnoDB storage engine. The performance differences between the two systems will depend on the specific use case, and it is recommended to run benchmarks to determine which system best meets your needs.
  4. Storage Engines: MariaDB supports a broader range of storage engines than MySQL. In addition to the default InnoDB engine, MariaDB offers the Aria, MyRocks, and ColumnStore engines, among others. This variety allows users to select the most suitable storage engine for their specific requirements, potentially leading to better performance and resource utilization.
  5. Security: MariaDB and MySQL offer robust security features, including data encryption, user privilege management, and authentication plugins. However, MariaDB provides additional security features like role-based access control, which can make managing user permissions more efficient in some cases.
  6. Community and Support: While MySQL benefits from Oracle’s backing and has a large user base, MariaDB enjoys strong community support and active development by the MariaDB Foundation. This results in frequent updates, new features, and a commitment to openness and collaboration. The choice between the two systems may be your preference for community-driven development versus corporate support.

In summary, MariaDB and MySQL are powerful and reliable database systems, each with strengths and weaknesses. When deciding between the two, consider factors such as licensing, compatibility, performance, storage engine requirements, security, and the level of community or corporate support that best aligns with your project’s needs.

Step 1: Update Manjaro

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

Step 2: Install MariaDB

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:

Step 3: Enable MariaDB Service

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


Step 4: Run MariaDB Security Script

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 can be accessed by anonymous users.

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

Example Output

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!

Step 5: Run MariaDB Database Tables Upgrade Tool

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):

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.

Additional Commands

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.


Installing MariaDB on Manjaro Linux is a straightforward process that involves updating your system, installing the database software, initializing the database, and securing the installation. Following the steps outlined in this guide, you can ensure that your MariaDB installation is secure, stable, and optimized for your Manjaro Linux system.

Additional Resources and Links

For further information and support on MariaDB, consider exploring the following official resources:

  • MariaDB Official Website:
    • The official website for MariaDB provides extensive information on the database software, including news, updates, and upcoming events.
  • MariaDB Documentation:
    • A comprehensive knowledge base containing detailed documentation on various aspects of MariaDB, including installation, configuration, and usage.
  • MariaDB on GitHub:
    • The official MariaDB GitHub repository, where you can find the source code, report issues, and contribute to the project.
  • MariaDB on Twitter:
    • Follow the official MariaDB Twitter account for the latest news, updates, and announcements related to MariaDB.
  • MariaDB on Facebook:
    • Connect with the MariaDB community on Facebook and stay informed about the latest developments and events.

Share to...