MariaDB is advertised as being one of the most popular open source relational databases valuing “performance, stability, and openness”. This is why it’s the default MySQL variant for Debian and as a result often the relational database of choice for the Raspberry Pi .
The latest version of the Raspberry Pi OS runs Debian 10 (Buster) which offers MariaDB 10.3 with a simple install. However, this was released three years ago, meaning you are missing out on three years worth of new features and improvements. An example of some of those improvements include:
The Raspberry Pi runs on the ARMHF architecture but there are currently no official MariaDB downloads available for that architecture. This means you will need to build MariaDB from source if you wish to gain access to the latest version.
Unfortunately the official documentation only provides a general guide for Debian users and assumes the MariaDB version you are building is already available from your repository. On top of that the MariaDB source code needs to be patched before it will compile on the the Raspberry Pi.
At the time of writing this guide builds MariaDB 10.5.6 on Raspberry Pi OS (Buster) with Linux Kernel 5.4.70.
Before continuing make sure your Raspberry Pi OS is up to date:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
If you run into problems further down the line you can try updating the firmware but it is generally not needed unless for specific reasons:
sudo rpi-update
If your Raspberry Pi is limited to 1GB of RAM then you will need to increase the Swap memory to a minimum of 1GB. I ran the entire build process on a freshly installed Raspberry Pi OS (32-bit) Lite edition which used 90% of the allocated 1GB of Swap memory. You might need to increase this further if you are already consuming more RAM.
You can see how much memory you have by running the free -h
command:
As you can see my total amount of RAM and Swap memory is 924MB and 99MB respectively. To increase the Swap memory to 1024MB (1GB) simply edit /etc/dphys-swapfile and modify the CONF_SWAPSIZE variable to:
CONF_SWAPSIZE=1024
#mariadb #database #raspberry-pi