This tutorial will explain how to install MariaDB on Debian 13. MariaDB is an open-source RDBMS (Relational Database Management System) used to store and retrieve tabular data using the Structured Query Language (SQL). Compared to MySQL, MariaDB is more scalable and offers a higher query speed, even though MySQL is an older database system and MariaDB is a fork of MySQL. MariaDB is written in C, C++, and Perl, has a huge community of developers, and is compatible with multiple OS such as Windows, macOS, and Linux. The data of big companies such as Google, Mozilla, and Wikipedia is stored in MariaDB databases. In the next paragraphs, we will show you how to install MariaDB, manage its service, secure the installation, and some basic commands for creating databases, users, etc.
Installing MariaDB is a straightforward process and should take up to 10 minutes. Let’s get started!
Table of Contents
Prerequisites
- A server running Debian 13 OS
- User privileges: root or non-root user with sudo privileges
Step 1. Update the System
We assume that you have a fresh Debian 13 OS. Before we start with the installation, we need to update the system packages. To do that, execute the following command:
sudo apt update -y && sudo apt upgrade -y
Step 2. Install MariaDB database
To install the MariaDB database management system, execute the following command:
sudo apt install mariadb-server -y
Once installed, follow the next paragraphs to manage the service. To start and enable the MariaDB database service, you can use the following commands:
sudo systemctl start mariadb && sudo systemctl enable mariadb
To check the status of the MariaDB service, you can use the command below:
sudo systemctl status mariadb
You should get the following output:
root@host:~# sudo systemctl status mariadb ● mariadb.service - MariaDB 11.8.1 database server Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; preset: enabled) Active: active (running) since Tue 2025-04-08 10:46:58 CDT; 2min 38s ago Invocation: 4075152b489d40b58cf17377f949148f Docs: man:mariadbd(8) https://mariadb.com/kb/en/library/systemd/ Main PID: 2580 (mariadbd) Status: "Taking your SQL requests now..." Tasks: 10 (limit: 30653) Memory: 296.6M (peak: 386.6M) CPU: 9.643s CGroup: /system.slice/mariadb.service └─2580 /usr/sbin/mariadbd Apr 08 10:46:57 host.test.vps mariadbd[2580]: 2025-04-08 10:46:57 0 [Note] InnoDB: log sequence number 47763; transaction id 14 Apr 08 10:46:57 host.test.vps mariadbd[2580]: 2025-04-08 10:46:57 0 [Note] Plugin 'FEEDBACK' is disabled. Apr 08 10:46:57 host.test.vps mariadbd[2580]: 2025-04-08 10:46:57 0 [Note] Plugin 'wsrep-provider' is disabled. Apr 08 10:46:57 host.test.vps mariadbd[2580]: 2025-04-08 10:46:57 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool Apr 08 10:46:57 host.test.vps mariadbd[2580]: 2025-04-08 10:46:57 0 [Note] InnoDB: Buffer pool(s) load completed at 250408 7:46:57 Apr 08 10:46:58 host.test.vps mariadbd[2580]: 2025-04-08 10:46:58 0 [Note] Server socket created on IP: '127.0.0.1'. Apr 08 10:46:58 host.test.vps mariadbd[2580]: 2025-04-08 10:46:58 0 [Note] mariadbd: Event Scheduler: Loaded 0 events Apr 08 10:46:58 host.test.vps mariadbd[2580]: 2025-04-08 10:46:58 0 [Note] /usr/sbin/mariadbd: ready for connections. Apr 08 10:46:58 host.test.vps mariadbd[2580]: Version: '11.8.1-MariaDB-2' socket: '/run/mysqld/mysqld.sock' port: 3306 Debian n/a Apr 08 10:46:58 host.test.vps systemd[1]: Started mariadb.service - MariaDB 11.8.1 database server.
Step 3. Secure the MariaDB Installation
Securing the MariaDB installation is crucial for the service to work correctly. To secure the MariaDB installation, execute the following command:
sudo mariadb-secure-installation
You should follow the steps below to secure MariaDB:
Enter current password for root (enter for none): Switch to unix_socket authentication [Y/n] Y Change the root password? [Y/n] Y New password: YourStrongMySQLROOTPasswordHere Re-enter new password: YourStrongMySQLROOTPasswordHere 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 ... Success! Cleaning up... All done! If you've completed all of the above steps, your MariaDB installation should now be secure. Thanks for using MariaDB!
After successful securing, there will be a message as explained above.
Step 4. Create Test Database and User
Please execute the command below in the MariaDB console to create a database user and grant the correct permissions. First, we need to log in to the console:
mysql -u root -p
You will have to enter the password you set in the previous step, and you will be redirected to the MariaDB console:
root@host:~# mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 45 Server version: 11.8.1-MariaDB-2 Debian n/a Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Support MariaDB developers by giving a star at https://github.com/MariaDB/server Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]>
Now, you can execute the following commands one by one:
CREATE DATABASE example_database; CREATE USER 'example_user'@'localhost' IDENTIFIED BY 'StrongPasswordUserHere'; GRANT ALL ON example_database.* TO 'example_user'@'localhost' WITH GRANT OPTION; FLUSH PRIVILEGES; EXIT;
That’s it. You learned how to install a MariaDB database server on Debian 13 OS and some basic commands for securing, database and user creation, etc.
Plenty of things can be done with the MariaDB server, such as optimizing, exporting a dump, importing a backup, executing SQL queries, etc. Of course, you don’t have to do this if you have difficulties and are unfamiliar with Linux and MySQL(MariaDB) servers. You can always contact our technical support. You only need to sign up for one of our NVMe VPS server plans and submit a support ticket. We are available 24/7 and will take care of your request immediately.
If you liked this post about installing the MariaDB database server on Debian 13, please share it with your friends or leave a comment below.