Language: EN


How to install MariaDB on Raspberry Pi

In this post we will see how to install MariaDB on a Debian-based Linux distribution such as 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 refer to it frequently.

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 open source software development community.

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

Be that as it may, these were the reasons for the creation of MariaDB in 2009 as a database derived from MySQL and with almost total compatibility. This compatibility means that it is often 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 of this blog, unless expressly indicated, we will use MariaDB as the preferred option for MySQL/MariaDB projects.

Install MariaDB

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

sudo apt update

Next, we install MariaDB by running 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 in MySQL, the “factory” configuration is insecure because we should not leave the default parameters. Therefore, the immediate next step is to run the script.

sudo mysql_secure_installation

We answer the questions about users and passwords, and now the installation is ready.

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

systemctl status mariadb.service

Testing MariaDB

As we have mentioned, the compatibility of MariaDB with MySQL is 1:1. Therefore, the usage 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 repeating ourselves, we refer you to the previous 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 because it is more aligned with the open source community.

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