How to Install MariaDB on Debian 10

Install MariaDB on Debian 10

In this article, we will have explained the necessary steps to install and configure MariaDB on Debian 10. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

MariaDB is a free and open source fork of well known MySQL database management server software, developed by the brains behind MySQL, it’s envisioned to remain free/open source. MariaDB is a drop-in replacement of MySQL with more features, new storage engines, and better performance.

Install MariaDB on Debian

Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.

sudo apt update
sudo apt upgrade

Step 2. Install MariaDB.

First, import MariaDB gpg key and add repository:

sudo apt-key adv --recv-keys --keyserver 0xF1656F24C74CD1D8
sudo add-apt-repository 'deb [arch=amd64]

Install the MariaDB server and client packages by running the following command:

sudo apt install mariadb-server

Now confirm the installation by typing following:

mysql -V

After installing MariaDB in your system start it’s service using the following command:

sudo systemctl start mariadb
sudo systemctl enable mariadb

Step 3. Secure MariaDB server.

You should now run mysql_secure_installation to configure security for your MariaDB server:

sudo mysql_secure_installation

Then enter yes/y to the following security questions:

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
    Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
    Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
    Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y

As a test, you can log into the MariaDB server and run the version command:

mysql -u root -p

Congratulation, you have learned how to install and configure MariaDB on Debian 10 Buster. If you have any question, please leave a comment below.