In this tutorial we will show you how to install MariaDB on Debian 10. For those of you who didn’t know, MariaDB is a multi-thread, open-source relational database management system, a perfect replacement of MySQL database system. MariaDB maintained and developed by the MariaDB Foundation, including some of the MySQL developers.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation MariaDB database management system on a Debian 10 (Buster) server.
Install MariaDB on Debian 10
Step 1. Before we install any software, it’s important to make sure your system is up to date by running these following apt commands in the terminal:
sudo apt update sudo apt upgrade
Step 2. Installing MariaDB on Debian 10.
Once the repositories package list updated in your system, you can start the MariaDB installation using below command:
sudo apt install mariadb-server
After complete, you can verify MariaDB is installed by running the below command:
sudo systemctl start mariadb sudo systemctl status mariadb
Step 3. Secure MariaDB server.
By default, MariaDB is not hardened. You can secure MariaDB using the mysql_secure_installation script. you should read and below each steps carefully which will set root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MariaDB:
Configure it like this:
- Set root password? [Y/n] y - Remove anonymous users? [Y/n] y - Disallow root login remotely? [Y/n] y - Remove test database and access to it? [Y/n] y - Reload privilege tables now? [Y/n] y
Once you have secured your MariaDB installation, you can connect to mysql shell using the root user password:
mysql -u root -p
To create a database named “idroot_db” and a user named “idroot_user” with full privileges to manage the database run the following SQL commands:
MariaDB [(none)]> CREATE DATABASE idroot_db; MariaDB [(none)]> GRANT ALL ON idroot_db.* TO 'idroot_user'@'localhost' IDENTIFIED BY 'idroot_user_passwd_here' WITH GRANT OPTION; MariaDB [(none)]> FLUSH PRIVILEGES; MariaDB [(none)]> exit;
Congratulation’s! You have successfully installed MariaDB. Thanks for using this tutorial for installing MariaDB database management system on Debian 10 (Buster). For additional help or useful information, we recommend you to check the official MariaDB website.