In this article, we will have explained the necessary steps to install MariaDB on Debian 11. Before continuing with this tutorial, make sure you are logged in as a user with
sudo privileges. All the commands in this tutorial should be run as a non-root user.
MariaDB is a fork of MySQL database and is developed as an open-source solution, primarily under the GPL license. MySQL has been replaced with MariaDB in Debian repositories, which is a decent alternative to MySQL and pretty much performs every operation that MySQL performs.
Install MariaDB on Debian 11
Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.
sudo apt update sudo apt upgrade sudo apt install software-properties-common dirmngr gnupg2 sudo apt install apt-transport-https wget curl
Step 2. Install MariaDB on Debian Bullseye system.
Run the following command below to install MariaDB on your Debian:
sudo apt install mariadb-server
Once the installation of MariaDB is complete, start and enable it. Start it with the command of
sudo systemctl start mariadb sudo systemctl stop mariadb sudo systemctl restart mariadb
Step 3. Secure MariaDB Installation.
MariaDB comes with a default security script,
mysql_secure_installationthat is used to improve the security of MariaDB installation by:
- Setting the password for root accounts (if need be).
- Disabling remote root login to the databases.
- Removing anonymous-user accounts.
- Removing the test database, which by default can be accessed by anonymous users.
Now, to secure MariaDB, execute the below-mentioned command:
Now to verify the security we will run the following command to enter the environment of MariaDB and then type the set password to access it:
sudo mysql -u root -p
Step 4. Creating a New Administrative User.
Now create a new administrative user. This will be the first user to access your MariaDB server after installation. Run the following statement to create a new user with a username of
linuxtips, and with a password of
[email protected]. Feel free to change the username and password to suit your needs:
GRANT ALL ON *.* TO 'linuxtips'@'localhost' IDENTIFIED BY '[email protected]' WITH GRANT OPTION; FLUSH PRIVILEGES; exit;
That’s all you need to do to install the MariaDB on Debian (Bullseye). I hope you find this quick tip helpful. For further reading MariaDB database on Debian’s system, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.