MariaDB is a community-developed fork of the MySQL relational database management system intended to remain free under the GNU GPL. Development is led by some of the original developers of MySQL, who forked it due to concerns over its acquisition by Oracle Corporation. Contributors are required to share their copyright with the MariaDB Foundation.

MariaDB Server is one of the most popular database servers in the world. It’s made by the original developers of MySQL and guaranteed to stay open source. Notable users include Wikipedia, WordPress.com and Google.

In this guide, we will explain how to install the latest version of MariaDB on a Debian 9 server.

You can also read the guide on installing MariaDB on a CentOS 7 server and on an Ubuntu server

sudo apt install mariadb-server

Cloudwafer-Debian-MariaDB-2

After installation, issue the command below to check the status of our MariaDB installation:

sudo systemctl status mariadb

Cloudwafer-Debian-MariaDB-3

Our MySQL database is now running so the next thing to do is to run a simple security script that will remove some dangerous defaults and lock down some default access to our database system. Start the script by issuing the command below:

sudo mysql_secure_installation

The script will ask a couple of questions including:

  • Current root password – Since this is a new installation of MySQL, you probably don’t have one so you can leave it blank and you will be asked if you want to set one. Type Y and proceed.
  • Remove anonymous users - Type Y or press the enter button to choose the default (which is Y).
  • Disable root login remotely - Type Y or press the enter button to choose the default (which is Y).
  • Remove test database - Type Y or press the enter button to choose the default (which is Y)
  • Reload privilege tables - Type Y or press the enter button to choose the default (which is Y)

Cloudwafer-Debian-MariaDB-4

Cloudwafer-Debian-MariaDB-5

After securing the database server, we can verify MariaDB is working as needed. Type the command below to check the version installed:

mysql --version

We can also use the mysqladmin tool, a client that lets you run administrative commands by typing the command:

sudo mysqladmin -u root -p version

This indicates the installation has been successful.