Introduction

MariaDB database management system is one of the most used open-source systems. It is currently gaining ground because it provides reliable and efficient results compared to MySQL. When using Debian as the server OS, installing MariaDB is relatively simple. Installing MariaDB with some basic setting on a Debian system will be extremely easy and simple in this tutorial.

 

System Requirements for MariaDB Installation

Before installing MariaDB, make sure your system satisfies the following minimum requirements:

    • Processor: Minimum 1 GHz (64-bit preferred).
    • RAM: At least 512 MB (1 GB recommended for optimal performance).
    • Disk Space: Minimum 1 GB free space.

 

Preparing Your Debian System

    1. Update the system packages to ensure you have the latest updates and fixes.
    2. Make sure you have root or sudo user access to run administrative commands.

 

Step 1: Update Your System

This is a general installation. Before installation, it is always advisable to update the system so that all the packages are updated. Use the following command:

sudo apt update && sudo apt upgrade

The command above updates the package lists and then installs the latest versions of installed packages. This depends on the state of your system hence should take some minutes.

 

Step 2: Install MariaDB Server

Installing MariaDB on Debian is as simple as running one command. Use the following to install MariaDB:

sudo apt install mariadb-server

During the installation, the package manager will download and configure MariaDB for your system.

 

Step 3: Start and Secure MariaDB

  • Start the MariaDB Service

After installation, start the MariaDB service using the command:

sudo systemctl start mariadb

  • Enable MariaDB on Boot

To ensure MariaDB starts automatically when the server boots, run the following command:

sudo systemctl enable mariadb

  • Secure Installation

For added security, MariaDB also comes with an integrated secure installation script. Follow these steps with:

sudo mysql_secure_installation

Do the following when prompted:

    • Set the root password (if this hasn't already been done).
    • Delete anonymous users.
    • Disallow remote root login.
    • Delete the test database.

These changes greatly enhance the security of your database server.

 

Step 4: Test Your MariaDB Installation

  • Check the Status of the Service

Check that MariaDB is running with:

sudo systemctl status mariadb

You would now see an output that shows that the service is active and running.

  • Login to MariaDB

To confirm the installation, log in to the MariaDB shell:

sudo mysql -u root -p

Type in the password you set in the beginning for the root account. If the MariaDB shell opens, the installation was successful.

 

 

Additional Configuration Options

Adjusting Configuration Files

MariaDB's configuration files are generally found at /etc/mysql/mariadb.conf.d/. You may start altering the settings according to your needs in this location.

Enabling Remote Access
To allow remote connections, edit the MariaDB configuration file:

 

1. Open /etc/mysql/mariadb.conf.d/50-server.cnf and uncomment the following line:

bind-address = 127.0.0.1

  •  

2. Restart the service:

sudo systemctl restart mariadb

Ensure that your firewall permits incoming connections to the MariaDB port. The default port is 3306.

 

Common Troubleshooting Tips

  • Error During Installation

Verify the correct configuration of all package repositories with a system update:

sudo apt update

  • Service is Not Starting

View logs by using the command:

sudo journalctl -xe

  • Connection Issue

Verify configuration files and the configuration of your firewall.

 

Why MariaDB for My Debian Server?

MariaDB is preferred by many users because of the following reasons:

  • Enhanced Performance: Optimized queries and storage engines.
  • Open Source: 100% free and community-driven.
  • Compatibility: Works seamlessly with most MySQL tools and applications.
  • Security: Includes advanced features like encryption and secure password handling.

 

Conclusion

Installing MariaDB on Debian is a simple and rewarding process. By following this guide, you’ve set up a robust database server ready to handle your applications. With its reliability and features, MariaDB is an excellent choice for any hosting environment.

 

FAQs

1. What is MariaDB, and how is it different from MySQL?

  • MariaDB is a community-developed fork of MySQL with added features, better performance, and a strong focus on open-source principles.

2. Is MariaDB free to use?

  • Yes. MariaDB is completely free and open source, with zero licensing costs.

3. Can I install MariaDB alongside other Linux distributions?

  • Absolutely. MariaDB integrates well with many Linux distributions such as Ubuntu, CentOS, and Fedora

4. What are best practices for hardening MariaDB?

  • Use complex passwords, support secure connections and run the mysql_secure_installation command to harden your database

5. How do I update MariaDB to the newest version?

    • sudo apt update && sudo apt upgrade