Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

How to Install MariaDB on Debian 9

How to Install MariaDB on Debian 9

In this tutorial we will show you how to Install Mariadb on Debian 9. MariaDB is free and open source backward compatible, enhanced, drop-in replacement of the popular MySQL Database Server. It is very fast, stable and scalable database server which makes it one of the most used database servers in the World.

First of all login to your Debian 9 VPS via SSH as user root

ssh [email protected]_Address -p Port_number

and make sure that all installed packages are updated to the latest available version and install some required packages

sudo apt-get update && apt-get upgrade
sudo apt-get install software-properties-common dirmngr

In order to start with the MariaDB Server installation. we will add the official MariaDB repository to the sources.list. First, import the MariaDB GnuPG signing key used to sign the repositories. This key will enable apt to verify the integrity of the packages

sudo apt-key adv --recv-keys --keyserver 0xF1656F24C74CD1D8

Executing: /tmp/apt-key-gpghome.XA1plbwj7i/ --recv-keys --keyserver 0xF1656F24C74CD1D8
gpg: key F1656F24C74CD1D8: public key "MariaDB Signing Key " imported
gpg: Total number processed: 1
gpg: imported: 1

Once the key is added you can go ahead and add the appropriate repository. In this tutorial we will install the latest stable version of MariaDB, which is version 10.2. Run the following command

sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] stretch main'

Since new repository is added, we have to update the list of available packages on the server

sudo apt-get update

and run the following command to install MariaDB

sudo apt-get install mariadb-server

The installation is pretty fast and will take just few seconds. During the installation you will be prompted to enter a new password for the MySQL ‘root’ user. It is not mandatory, but it is highly recommended. Keep in mind that you should always use strong passwords for all users. It is best to use a combination of letters and numbers and minimum 10 characters long.

After the installation is completed you can verify it by checking the MariaDB version, as shown below

mysql -V
mysql Ver 15.1 Distrib 10.2.13-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

Next, we will use the mysql_secure_installation post installation script to do basic security hardening on the MariaDB server. Run the script and use the following options


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

All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.

That’s all. With this step MariaDB server is successfully installed on your Debian 9 VPS. For more information on how to configure and use MariaDB you can check their official documentation.

PS. If you liked this post, on how to Install MariaDB on Debian 9, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

This post first appeared on Virtual Server, please read the originial post: here

Share the post

How to Install MariaDB on Debian 9


Subscribe to Virtual Server

Get updates delivered right to your inbox!

Thank you for your subscription