como-instalar-mariadb-en-raspberry-pi

How to install MariaDB on Raspberry Pi

  • 2 min

In this post, we are going to see how to install MariaDB on a Debian-based Linux distribution like Raspbian on Raspberry Pi.

In the previous post, we saw how to install MySQL on Raspberry Pi. This post is closely related, so we will frequently refer to it.

MariaDB is a database management system derived from MySQL with a GPL (General Public License). It is developed by Michael Widenius, one of the founders of MySQL, the MariaDB Foundation, and the free software developer community.

When Oracle purchased MySQL, it made certain changes to the licensing that concerned the community, even leading to the threat that they ultimately wanted to harm it in favor of their commercial databases.

Whatever the case, these were the reasons for the creation of MariaDB in 2009 as a database derived from MySQL with almost total compatibility. This compatibility often leads to it being referred to as MySQL/MariaDB, indicating that either one is possible.

Since then, MariaDB has replaced MySQL in many distributions, developments, and servers. In fact, when it is now said that MySQL is the most used database in free projects, it should be said MySQL/MariaDB.

In the projects on this blog, unless expressly indicated, we will preferentially use MariaDB for MySQL/MariaDB projects.

Install MariaDB

Installing MariaDB on Raspberry Pi is just as easy as with MySQL. In fact, it’s practically identical. First, we update packages with,

sudo apt update

Next, we install MariaDB by executing the following command,

sudo apt install mariadb-server

As we can see, exactly the same as in the MySQL tutorial but changing ‘mysql-server’ to ‘mariadb-server’.

Just like with MySQL, the “out-of-the-box” configuration is insecure because we should not leave the default parameters. For this reason, the immediate next step is to run the script.

sudo mysql_secure_installation

We answer the user and password questions, and the installation is ready.

Finally, we check that the service is running correctly with the following command

systemctl status mariadb.service

Testing MariaDB

As mentioned, MariaDB’s compatibility with MySQL is 1:1. Therefore, its use is identical to what we saw in the previous post, where we saw how to create users, databases, and tables with the MySQL CLI. To avoid repetition, we refer you to that post.

And that’s how easy it was to install MariaDB. You can use MySQL/MariaDB interchangeably, as you prefer, although we encourage you to use MariaDB as it is more aligned with the free software community.

In upcoming posts, we will see how to install two MySQL/MariaDB clients, phpMyAdmin and Dbeaver, to manage our database.