sammlinux sammlinux
  • Ubuntu
    UbuntuShow More
    How To Install and Use Docker CE on Ubuntu 22.04
    26 Min Read
    How To Install and Secure phpMyAdmin on Ubuntu 22.04
    5 Min Read
    How To Secure SSH with Fail2Ban on Ubuntu 22.04
    8 Min Read
    How To Install Uptime Kuma on Ubuntu 22.04
    17 Min Read
    How To Install Ubuntu Server 22.04 LTS with Screenshots
    14 Min Read
  • Rocky Linux
    Rocky LinuxShow More
    How To Install phpMyAdmin on Rocky Linux 9
    15 Min Read
    How To Secure SSH with Fail2Ban on Rocky Linux 9
    12 Min Read
    How To Install Rocky Linux 9.2 Server with Screenshots
    12 Min Read
    How To Set Up a Firewall Using FirewallD on Rocky Linux 9
    8 Min Read
    How To Install Nginx on Rocky Linux 9: A Comprehensive Guide
    10 Min Read
  • Debian
    DebianShow More
    How To Secure SSH with Fail2Ban on Debian 11
    8 Min Read
    How To Install Debian 11 (Bullseye) Server with Pictures
    12 Min Read
    How To Install and Setup Node.js on Debian 11
    6 Min Read
    How To Install PHP 8.2 on Debian 11
    12 Min Read
    How To Install Nginx on Debian 11: A Comprehensive Guide
    9 Min Read
  • Linux
    LinuxShow More
    Best Practices Linux Server Security for System Administrator
    8 Min Read
    A Simple Guide: How To Manage Groups on Linux
    5 Min Read
    How To Manage Log Files Using Logrotate In Linux
    7 Min Read
    The Easy Ways to Check File Size in Linux
    7 Min Read
    How To Backup Files From Remote Linux VPS Using Rsync Script
    12 Min Read
  • CentOS
    CentOSShow More
    How To Secure SSH with Fail2Ban on CentOS 7
    9 Min Read
    How To Install PHP 8.2 on CentOS 7 / RHEL 7
    18 Min Read
    How To Install Apache Web Server on CentOS 7
    11 Min Read
    How To Set Up a Firewall Using FirewallD on CentOS 7
    5 Min Read
    Initial Setup CentOS 7 Server: Secure and Efficient
    9 Min Read
  • DevOps
    DevOpsShow More
    How To Create AWS CloudFront: A Step-by-Step Guide
    10 Min Read
Reading: How To Install MariaDB 10.9 on Debian 11 Server
Share
Font ResizerAa
Linux for BeginnersLinux for Beginners
  • Ubuntu
  • Rocky Linux
  • Debian
  • Linux
  • CentOS
  • DevOps
Search
  • Ubuntu
  • Rocky Linux
  • Debian
  • Linux
  • CentOS
  • DevOps
Follow US
Copyright © 2014-2023 Ruby Theme Ltd. All Rights Reserved.

How To Install MariaDB 10.9 on Debian 11 Server

Samuel Siahaan
By Samuel Siahaan
Last updated: September 8, 2023
SHARE

Introduction MariaDB 10.9

MariaDB is a popular open-source relational database management system and a drop-in replacement for MySQL presently. MariaDB 10.9, in fact brings enhanced features and performance improvements. Are you ready to dive into the world of database management on your Debian 11 server? Well for this reason, in this tutorial we’ll guide you through the straightforward process of how to install MariaDB 10.9 on Debian 11 Server. Whether you’re a Linux novice or a seasoned pro, we’ve got you covered.

Contents
Introduction MariaDB 10.9Table of ContentsPrerequisites for Install MariaDB 10.9Installing MariaDB 10.9 on Debian 11Step 1: Update System PackagesStep 2: Install Required PackagesStep 3: Add MariaDB 10.9 APT RepositoryStep 4: Install MariaDB 10.9 on Debian 11Step 5: Install Secure MariaDB 10.9Step 6: Start and Enable MariaDB 10.9Step 7: Check MariaDB VersionStep 8: Basic MariaDB CommandsMariaDB Create DatabaseMariaDB add User and Grant PrivilegesCreate a Table and Add Data MariaDBStep 9: Optional: Configure MariaDB 10.9MariaDB 10.9 Clean upConclusion

Table of Contents

  • Introduction MariaDB 10.9
  • Prerequisites for Install MariaDB 10.9
  • Installing MariaDB 10.9 on Debian 11
    • Step 1: Update System Packages
    • Step 2: Install Required Packages
    • Step 3: Add MariaDB 10.9 APT Repository
    • Step 4: Install MariaDB 10.9 on Debian 11
    • Step 5: Install Secure MariaDB 10.9
    • Step 6: Start and Enable MariaDB 10.9
    • Step 7: Check MariaDB Version
    • Step 8: Basic MariaDB Commands
      • MariaDB Create Database
      • MariaDB add User and Grant Privileges
      • Create a Table and Add Data MariaDB
    • Step 9: Optional: Configure MariaDB 10.9
  • Conclusion

Prerequisites for Install MariaDB 10.9

Before we dive into the installing MariaDB 10.9 on Debian 11 there is prerequisite you need to ensure are in place:

  • Debian 11 Server: Make sure you have a clean installation of Debian 11 Server. Additionally, you can deploy this on a physical machine or a virtual environment like VMware or VirtualBox. For detailed instructions, to set this up, use following guide :
    • Initial Setup Debian 11 Server: Secure and Efficient
  • A stable internet connection of course.

Installing MariaDB 10.9 on Debian 11

Here’s a simple guide on how to install and configure MariaDB 10.9 on Debian 11. By following these steps, you can tap into the advantages it offers:

Step 1: Update System Packages

Start by updating your system’s package list to ensure you’re working with the latest software versions by using following commands:

- Advertisement -
Bash
samm@mariadb:~$ sudo apt-get update
samm@mariadb:~$ sudo apt-get upgrade

Step 2: Install Required Packages

To install the required packages for MariaDB in Debian 11, run the following commands:

Bash
samm@mariadb:~$ sudo apt-get install curl software-properties-common gnupg2
samm@mariadb:~$ sudo apt update && sudo apt -y full-upgrade

Step 3: Add MariaDB 10.9 APT Repository

Now, let’s dive into the main event: installing MariaDB 10.9. To install MariaDB 10.9, firstly, you’ll need to add the official MariaDB repository. Furthermore, this repository provides access to the latest MariaDB packages. For this purpose we’ll use the APT package manager for this. In your terminal, execute the following command:

Bash
samm@mariadb:~$ curl -LsS -O https://downloads.mariadb.com/MariaDB/mariadb_repo_setup
samm@mariadb:~$ sudo bash mariadb_repo_setup --mariadb-server-version=10.9

If successful, the output should similar the following:

Bash
# [info] Checking for script prerequisites.
# [info] MariaDB Server version 10.9 is valid
# [info] Repository file successfully written to /etc/apt/sources.list.d/mariadb.list
# [info] Adding trusted package signing keys...
# [info] Running apt-get update...
# [info] Done adding trusted package signing keys

Step 4: Install MariaDB 10.9 on Debian 11

Now, it’s time to install MariaDB. First, update packages and then proceed to install the MariaDB server.

Bash
samm@mariadb:~$ sudo apt-get update
samm@mariadb:~$ sudo apt-get install mariadb-server mariadb-client

Then this proceed to install MariaDB packages and all its dependencies:

- Advertisement -
Bash
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  galera-4 gawk libcgi-fast-perl libcgi-pm-perl libclone-perl libconfig-inifiles-perl libdaxctl1 libdbd-mariadb-perl libdbi-perl libencode-locale-perl libfcgi-bin libfcgi-perl libfcgi0ldbl libhtml-parser-perl
  libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl liblwp-mediatypes-perl libmariadb3 libndctl6 libpmem1 libsigsegv2 libterm-readkey-perl libtimedate-perl
  liburi-perl mariadb-client-core mariadb-common mariadb-server-core mysql-common psmisc pv socat
Suggested packages:
  gawk-doc libmldbm-perl libnet-daemon-perl libsql-statement-perl libdata-dump-perl libipc-sharedcache-perl libwww-perl mailx mariadb-test netcat-openbsd doc-base
The following NEW packages will be installed:
  galera-4 gawk libcgi-fast-perl libcgi-pm-perl libclone-perl libconfig-inifiles-perl libdaxctl1 libdbd-mariadb-perl libdbi-perl libencode-locale-perl libfcgi-bin libfcgi-perl libfcgi0ldbl libhtml-parser-perl
  libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl liblwp-mediatypes-perl libmariadb3 libndctl6 libpmem1 libsigsegv2 libterm-readkey-perl libtimedate-perl
  liburi-perl mariadb-client mariadb-client-core mariadb-common mariadb-server mariadb-server-core mysql-common psmisc pv socat
0 upgraded, 36 newly installed, 0 to remove and 1 not upgraded.
Need to get 29.1 MB of archives.
After this operation, 222 MB of additional disk space will be used.
Do you want to continue? [Y/n] 

Step 5: Install Secure MariaDB 10.9

For security reasons, in the first place run the provided script to secure your MariaDB installation. Therefore, follow the prompts to configure settings like setting a root password, removing anonymous users, disallowing remote root login, and removing the test database. In addition these steps help enhance the security of your MariaDB installation,

Bash
samm@mariadb:~$ sudo mariadb-secure-installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.
Enter current password for root (enter for none): 
OK, successfully used password, moving on...
Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.
You already have your root account protected, so you can safely answer 'n'.
Switch to unix_socket authentication [Y/n] Y
Enabled successfully!
Reloading privilege tables..
 ... Success!
You already have your root account protected, so you can safely answer 'n'.
Change the root password? [Y/n] Y
New password: [Your Password]
Re-enter new password: [Your Password]
Password updated successfully!
Reloading privilege tables..
 ... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y
 ... Success!
Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y
 ... Success!
By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
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!

Step 6: Start and Enable MariaDB 10.9

After install MariaDB, now run the following commands to start MariaDB and enable it to automatically start on system reboot

Bash
samm@mariadb:~$ sudo systemctl start mariadb
samm@mariadb:~$ sudo systemctl enable mariadb
Synchronizing state of mariadb.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable mariadb

Confirm that MariaDB is running by using following command:

- Advertisement -
Bash
samm@mariadb:~$ sudo systemctl status mariadb
● mariadb.service - MariaDB 10.9.8 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
    Drop-In: /etc/systemd/system/mariadb.service.d
             └─migrated-from-my.cnf-settings.conf
     Active: active (running) since Fri 2023-09-08 23:30:54 WIB; 8min ago
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
   Main PID: 5438 (mariadbd)
     Status: "Taking your SQL requests now..."
      Tasks: 9 (limit: 2321)
     Memory: 211.5M
        CPU: 293ms
     CGroup: /system.slice/mariadb.service
             └─5438 /usr/sbin/mariadbd
Sep 08 23:30:53 server-mariadb mariadbd[5438]: 2023-09-08 23:30:53 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
Sep 08 23:30:53 server-mariadb mariadbd[5438]: 2023-09-08 23:30:53 0 [Warning] You need to use --log-bin to make --expire-logs-days or --binlog-expire-logs-seconds work.
Sep 08 23:30:53 server-mariadb mariadbd[5438]: 2023-09-08 23:30:53 0 [Note] Server socket created on IP: '127.0.0.1'.
Sep 08 23:30:54 server-mariadb mariadbd[5438]: 2023-09-08 23:30:54 0 [Note] InnoDB: Buffer pool(s) load completed at 230908 23:30:54
Sep 08 23:30:54 server-mariadb mariadbd[5438]: 2023-09-08 23:30:54 0 [Note] /usr/sbin/mariadbd: ready for connections.
Sep 08 23:30:54 server-mariadb mariadbd[5438]: Version: '10.9.8-MariaDB-1:10.9.8+maria~deb11'  socket: '/run/mysqld/mysqld.sock'  port: 3306  mariadb.org binary distribution
Sep 08 23:30:54 server-mariadb systemd[1]: Started MariaDB 10.9.8 database server.
Sep 08 23:30:54 server-mariadb /etc/mysql/debian-start[5456]: Upgrading MySQL tables if necessary.
Sep 08 23:30:54 server-mariadb /etc/mysql/debian-start[5469]: Checking for insecure root accounts.
Sep 08 23:30:54 server-mariadb /etc/mysql/debian-start[5473]: Triggering myisam-recover for all MyISAM tables and aria-recover for all Aria tables

Step 7: Check MariaDB Version

In order to check MariaDB version, we need to login to MariaDB as below. Use -p if you have set the root password.

Bash
samm@mariadb:~$ mysql -u root -p
Enter password: [Your password]
SQL
Welcome to the MariaDB monitor.  Commands end with ; or g.
Your MariaDB connection id is 41
Server version: 10.9.8-MariaDB-1:10.9.8+maria~deb11 mariadb.org binary distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
MariaDB [(none)]> SELECT VERSION();
+-------------------------------------+
| VERSION()                           |
+-------------------------------------+
| 10.9.8-MariaDB-1:10.9.8+maria~deb11 |
+-------------------------------------+
1 row in set (0.000 sec)

Step 8: Basic MariaDB Commands

Before you start using MariaDB 10.9, here some basic commands:

To access the MariaDB shell, use following command:

Bash
samm@mariadb:~$ mysql -u root -p

MariaDB Create Database

To create a database in MariaDB, login as shown above and run the below command.

SQL
#Create a new database
MariaDB [(none)]> CREATE DATABASE sammlinux_db;
#If the database with the same exists
MariaDB [(none)]> CREATE DATABASE sammlinux_db;
ERROR 1007 (HY000): Can't create database 'sammlinux_db'; database exists
#Create a database if already exits
MariaDB [(none)]> CREATE OR REPLACE DATABASE sammlinux_db;
Query OK, 2 rows affected (0.009 sec)
#First check if a database exists 
MariaDB [(none)]> CREATE DATABASE IF NOT EXISTS sammlinux_db;
Query OK, 1 row affected, 1 warning (0.000 sec)
# Check Databases MariaDB
MariaDB [(none)]> SHOW DATABASES;

MariaDB add User and Grant Privileges

To create a user and grant privileges use following syntax;

SQL
#Create user mariadb
CREATE USER 'sammlinux-user'@'localhost' IDENTIFIED BY 'your-password';
#Grant all privileges to the user
GRANT ALL PRIVILEGES ON *.* TO 'sammlinux-user'@'localhost' IDENTIFIED BY 'your-password';
#Grant privileges to a specific database
GRANT ALL PRIVILEGES ON 'sammlinux_db'.* TO 'sammlinux-user'@'localhost';
#Remember to refresh the privileges
FLUSH privileges;
#To check user grants in MariaDB
SHOW GRANTS FOR 'sammlinux-user'@'locahost';

Create a Table and Add Data MariaDB

Once you have created a database, you can create table and add data into it

SQL
CREATE TABLE articles (articles_id INT, name VARCHAR(20), channel VARCHAR(20));
INSERT INTO articles (id,name,email) VALUES(56701,"samm","Linux")

Step 9: Optional: Configure MariaDB 10.9

Depending on your requirements, for that reason you can configure MariaDB 10.9 for optimal performance. For instance, you can fine-tune settings to enhance its efficiency further. Open the configuration file with following command:

Bash
samm@mariadb:~$ sudo vi /etc/mysql/mariadb.conf.d/50-server.cnf

Here you can adjust settings like innodb_buffer_pool_size in order to allocate memory for caching data, or max_connections to control the number of concurrent connections.

MariaDB 10.9 Clean up

To completely remove MariaDB 10.9, run the following commands.

Bash
samm@mariadb:~$ sudo apt purge mariadb-server
samm@mariadb:~$ sudo rm -rf /var/lib/mysql/

Conclusion

To begin with, in this tutorial, we’ve walked you through the process of installing MariaDB 10.9 on your Debian 11 server. Subsequently, we began by ensuring your system was up to date, followed by the installation of MariaDB. We also secured the installation and verified that everything is running smoothly.

At this point, you’re ready to dive deeper into the world of database management on your Debian 11 server. Additionally, you can explore advanced configurations and optimize performance to meet your specific needs. Whether you’re using it for personal projects or business endeavors, MariaDB is a powerful tool that will help you manage your data efficiently.

With this step-by-step guide, even if new to Linux and database management can get up and running quickly. So, what are you waiting for? For that reason start exploring the possibilities that MariaDB on Debian 11 can offer!

Firstly, if you encounter any issues or have specific database-related tasks, refer to the MariaDB documentation for more information and guidance. Additionally, feel free to explore the numerous features and capabilities that MariaDB offers for building and maintaining robust database applications. Lastly, happy database management!

Also Read Our Other Guides :

  • How To Install MariaDB 10.6 on Debian 11 Server
  • How To Install MariaDB 10.6 on Ubuntu Server 22.04
  • How To Install MySQL 8.0 on Debian 11
  • How To Install DBeaver Community on Ubuntu 22.04

As I have shown, now you have learned how to install MariaDB 10.9 on Debian 11 Server.

TAGGED:DatabasesDebianMariaDBMySqlRDBMS

Sign Up For Daily Newsletter

Be keep up! Get the latest breaking news delivered straight to your inbox.
[mc4wp_form]
By signing up, you agree to our Terms of Use and acknowledge the data practices in our Privacy Policy. You may unsubscribe at any time.
Share This Article
Facebook Copy Link Print
Previous Article How To Install and Configure Apache on Rocky Linux 9
Next Article How To Install PHP 7.4 on Debian 11
Leave a Comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

How To Install and Secure phpMyAdmin on Ubuntu 22.04
Ubuntu
Install and Configure Docker Swarm Mode on Centos 7
CentOS
How To Install and Config Thumbor on Debian 10
Debian
How To Install MariaDB 10.6 on Debian 11 Server
Debian
How To Install MongoDB 6.0 on Debian 10 & 11
Debian

You Might Also Like

Debian

How To Set Up a Firewall with UFW on Debian 11

8 Min Read
Debian

How To Install Redis on Debian 11 Server

14 Min Read
Debian

How To Install Debian 11 (Bullseye) Server with Pictures

12 Min Read
Debian

How To Build NGINX from Source (Compile) on Debian 11

12 Min Read
Debian

How To Install MySQL 8.0 on Debian 11

14 Min Read
Debian

How To Install Apache Solr 9.1 on Debian 11

9 Min Read
Ubuntu

How To Install MariaDB 10.6 on Ubuntu Server 22.04

14 Min Read
Ubuntu

How To Install Nextcloud with Apache and MariaDB on Ubuntu Server 22.04

20 Min Read
Show More

Always Stay Up to Date

Subscribe to our newsletter to get our newest articles instantly!

sammlinux sammlinux

Providing beginner-friendly Linux tutorials and open-source guides to simplify your digital infrastructure.

www.sammlinux.com © 2026 | All Rights Reserved

Join Us!
Subscribe to our newsletter and never miss our latest news, podcasts etc.

Subscribe to our newsletter to get our newest articles instantly!

Zero spam, Unsubscribe at any time.
Welcome Back!

Sign in to your account

Username or Email Address
Password

Lost your password?