DebianDebian Based

How To Install MariaDB on Debian 11

Install MariaDB on Debian 11

In this tutorial, we will show you how to install MariaDB on Debian 11. For those of you who didn’t know, MariaDB is a popular open-source relational database, developed by MySQL developers. Unlike MySQL, MariaDB was meant to be totally free to use. The original creators of MySQL developed MariaDB in response to fears that MySQL will suddenly become a paid service due to Oracle’s acquisition. With its history of doing similar tactics, the developers behind MariaDB have promised to keep it open source and free from such fears as what has happened to MySQL.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the MariaDB database on a Debian 11 (Bullseye).

Prerequisites

  • A server running one of the following operating systems: Debian 11 (Bullseye).
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for MariaDB.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install MariaDB on Debian 11 Bullseye

Step 1. Before we install any software, it’s important to make sure your system is up to date by running the following apt commands in the terminal:

sudo apt update
sudo apt upgrade
sudo apt install software-properties-common dirmngr

Step 2. Installing MariaDB on Debian 11.

Now we add MariaDB signing key and APT repository:

wget https://mariadb.org/mariadb_release_signing_key.asc
sudo chmod -c 644 mariadb_release_signing_key.asc
sudo mv -vi mariadb_release_signing_key.asc /etc/apt/trusted.gpg.d/

Next, add the MariaDB repository manually on your Debian system:

echo "deb [arch=amd64,arm64,ppc64el] \
https://ftp.ubuntu-tw.org/mirror/mariadb/repo/10.6/debian \
bullseye main" | sudo tee /etc/apt/sources.list.d/mariadb.list

Once done, install MariaDB using the following command below:

sudo apt update
sudo apt install mariadb-server

Confirm the installation of MariaDB by checking the version and build:

mariadb --version

Now run the following commands to start MariaDB and enable it to automatically start on system reboot:

sudo systemctl start mariadb
sudo systemctl enable mariadb

Step 3. Secure MariaDB installation.

By default, MariaDB is not hardened. You can secure MariaDB using the mysql_secure_installation script. you should read and below each step carefully which will set a root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MariaDB:

mysql_secure_installation

Configure it like this:

- Set root password? [Y/n] y
- Remove anonymous users? [Y/n] y
- Disallow root login remotely? [Y/n] y
- Remove test database and access to it? [Y/n] y
- Reload privilege tables now? [Y/n] y

You can now connect to the MariaDB server using the new password:

mysql -u root -p

Congratulations! You have successfully installed MariaDB. Thanks for using this tutorial for installing the latest version of MariaDB 10.6 on Debian 11 Bullseye. For additional help or useful information, we recommend you check the official MariaDB website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button