MariaDB is a popular database and enables you to meet all your workload. MariaDB platform contains more features, better performance, and new storage engines. It is very similar to MySQL and in fact, it is a fork of MySQL. This article will give an ultimate guide to install MariaDB on Debian operating system.
What is MariaDB?
MariaDB is an open-source relational database management system used as an alternative to MySQL in the database components of the LAMP (Linux, Apache, MySQL, PHP/Python/Perl) stack. This platform is used for different proposes such as data warehousing, enterprise-level features, E-commerce, and logging applications. You can use it on any scale and any cloud database. MariaDB is well-documented, so if you need to solve a problem, you can get plenty of help online.
Steps to Install MariaDB on Debian
If you decide to install MariaDB and you use the Debian operating system, you can follow the step-by-step instruction presented in this article. Before starting the process of installing MariaDB on Debian, we recommend you buy and use the Linux VPS server plans provided on our website and enjoy its high quality and speed.
These are the requirements before you start the installation process:
– Updated Debian operating system
– Non-root administrative user
– Firewall Configured with UFW
Installing MariaDB on Debian
The first step you have to do before installation is to update your system. You can use the following apt command:
sudo apt update
Now, install the necessary packages using the command below:
sudo apt install mariadb-server
You should use the script that the mariadb-server package provides so that it can restrict access to the server and makes it possible to remove unused accounts. You should do this cause the default configuration leaves your installation insecure.
Configuring MariaDB on Debian
If you want to do a fresh installation of MariaDB, your next step is to run the existing security script. This script is highly effective because it overrides some of the less secure options, such as remote root login and sample users. The command below is to run the security script:
Using this command will take you to a series of prompts with which you can make changes to your MariaDB installation security options.
As you have a protected root account you can skip the next step by typing n and then pressing enter.
At the next prompt, you will be asked to change your root password. Answer the question by Typing n and answering no. It’s better to not change the configured authentication methods for that account.
At the next prompt, you can choose Y and press enter to accept the defaults for all other questions. This action will remove some anonymous users and the test database and also the login to the root will be disabled. After all these steps, you successfully finished MariaDB’s initial security configuration.
Creating an Administrative User that Uses Password Authentication (Optional)
Changing the root account is not recommended because most things like rotating logs or stopping the server are done by this user. This change in the /etc/mysql/debian.cnf configuration file may work initially, but updating the package will potentially overwrite these changes. So, instead of changing the root account, it is recommended to create a separate administrative account with a password.
You should open the MariaDB terminal and use the command below:
Create a new user with root privileges and password-base access. To match your preferences, you should ensure to change the username and password:
GRANT ALL ON . TO 'admin'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
If you want to ensure that changes are saved and available in your current section, flush the privileges:
The last step is to exit the MariaDB shell:
Now, it is time to test the MariaDB installation. As you installed the repositories, MariaDB will start running automatically. Use the following command to check the status:
sudo systemctl status mariadb
If you couldn’t start MariaDB, use the command below for this reason:
sudo systemctl start mariadb
Tip: For further checkout, you can connect to the database using mysqladmin tool. This will allow you to run administrative commands.
This Guide was a simple and step-by-step explanation for installing MariaDB on Debian operating system. Here, you learned how to install, configure, and as the last action, how to test MariaDB on your system. You also learned how to create an extra administrative user. We hope this was a useful tutorial for you.
Default MariaDB user accounts and privileges
The default configuration consists of: A privileged account with a username of root. The root user has remote access to the database.
When it comes to performing queries or replication, MariaDB is faster than MySQL. So if you need a high-performance relational database solution, MariaDB is a good choice. In addition, MariaDB also easily supports a high concurrent number of connections without much performance degradation.