Install MariaDB on Raspberry Pi

Install MariaDB on Raspberry Pi

MariaDB Server is a cross-platform relational database that allows to access data using SQL language. MariaDB Server is a fork of MySQL Server. This means that development of MariaDB was started from the original repository of MySQL. MariaDB is an open-source project which might be drop-in replacement for MySQL. MariaDB Server is available under the GPLv2 license.

This tutorial shows how to install MariaDB on Raspberry Pi.

Connect to Raspberry Pi via SSH, update the package lists and install MariaDB:

sudo apt update
sudo apt install -y mariadb-server

After the installation is completed, we can check MariaDB version:

mariadb --version

We can execute the following command to check whether MariaDB service is running:

sudo service mariadb status

If you want to stop, start and restart the MariaDB service then use these commands:

sudo service mariadb stop
sudo service mariadb start
sudo service mariadb restart

By default, password for the root user is blank. These means that we can connect to MariaDB Server without any authentication:

sudo mariadb -u root

One connected, execute the following SQL statement to change password for the root user:

ALTER USER root@localhost IDENTIFIED BY 'pwd123';

Run exit command inside the client to exit interactive mode:

exit

Now try to connect again to MariaDB Server using password:

mariadb -u root -p

Run the following command if you decided completely remove any package with a name that starts with mariadb and anything related to it:

sudo apt purge -y mariadb.*

Leave a Comment

Cancel reply

Your email address will not be published.