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.6 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.6 on Debian 11 Server

Samuel Siahaan
By Samuel Siahaan
Last updated: June 2, 2023
SHARE

Introduction MariaDB 10.6

MariaDB, an open-source relational database management system, is a powerful alternative to MySQL. Its latest version, MariaDB 10.6, brings enhanced features and performance improvements. If you’re using an Debian 11, this step-by-step guide will walk you through the process of install MariaDB 10.6, ensure optimal performance and data management for your applications.

Contents
Introduction MariaDB 10.6Table of ContentsPrerequisites for Install MariaDB 10.6Install MariaDB 10.6 on Debian 11Step 1: Update System PackagesStep 2: Install Required PackagesStep 3: Add MariaDB 10.6 APT RepositoryStep 4: Install MariaDB on Debian 11Step 5: Start and Enable MariaDB 10.6Step 6: Install Secure MariaDB 10.6Step 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.6MariaDB 10.6 Clean upConclusion

Table of Contents

  • Introduction MariaDB 10.6
  • Prerequisites for Install MariaDB 10.6
  • Install MariaDB 10.6 on Debian 11
    • Step 1: Update System Packages
    • Step 2: Install Required Packages
    • Step 3: Add MariaDB 10.6 APT Repository
    • Step 4: Install MariaDB on Debian 11
    • Step 5: Start and Enable MariaDB 10.6
    • Step 6: Install Secure MariaDB 10.6
    • 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.6
  • Conclusion

Prerequisites for Install MariaDB 10.6

Before we dive into the installation process, there is prerequisite you need to ensure are in place:

  • Debian 11 Server: Make sure you have a clean installation of Debian 11 Server. You can deploy this on a physical machine or a virtual environment like VMware or VirtualBox. To set this up, follow our guide :
    • Initial Setup Debian 11 Server: Secure and Efficient
  • A stable internet connection.

Install MariaDB 10.6 on Debian 11

Follow these steps to install MariaDB 10.6 on your Debian 11 Server and enjoy its benefits:

Step 1: Update System Packages

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

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

Step 2: Install Required Packages

samm@mariadb:~$ sudo apt-get install apt-transport-https curl

Step 3: Add MariaDB 10.6 APT Repository

To install MariaDB 10.6, you’ll need to add the official MariaDB repository:

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

If successful the output should be similar to below.

# [info] Checking for script prerequisites.
# [info] MariaDB Server version 10.6 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 on Debian 11

Now, it’s time to install MariaDB 10.6. Update packages and install MariaDB server

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

Proceed to install MariaDB packages and all its dependencies:

....
The following NEW packages will be installed:
  galera-4 gawk libcgi-fast-perl libcgi-pm-perl libclone-perl libdaxctl1 libdbd-mariadb-perl libdbi-perl libencode-locale-perl libfcgi-bin libfcgi-perl
  libfcgi0ldbl libgdbm-compat4 libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl
  liblwp-mediatypes-perl libmariadb3 libmpfr6 libndctl6 libperl5.32 libpmem1 libsigsegv2 libterm-readkey-perl libtimedate-perl liburi-perl lsof mariadb-client
  mariadb-client-10.6 mariadb-client-core-10.6 mariadb-common mariadb-server mariadb-server-10.6 mariadb-server-core-10.6 mysql-common perl perl-modules-5.32
  rsync
0 upgraded, 41 newly installed, 0 to remove and 0 not upgraded.
Need to get 37.5 MB of archives.
After this operation, 265 MB of additional disk space will be used.
Do you want to continue? [Y/n] y

During the installation process, maybe you’ll be prompted to set a root password for the MariaDB server. Make sure to choose a strong and secure password.

- Advertisement -

Step 5: Start and Enable MariaDB 10.6

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

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

samm@mariadb:~$ sudo systemctl status mariadb
● mariadb.service - MariaDB 10.6.12 Database Staging
     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 Wed 2022-12-14 23:54:00 WIB; 5s ago
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
    Process: 7856 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
    Process: 7857 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
    Process: 7859 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-enviro>
    Process: 7897 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
    Process: 7899 ExecStartPost=/etc/mysql/debian-start (code=exited, status=0/SUCCESS)
   Main PID: 7885 (mariadbd)
     Status: "Taking your SQL requests now..."
      Tasks: 11 (limit: 4676)
     Memory: 83.0M
        CPU: 257ms
     CGroup: /system.slice/mariadb.service
             └─7885 /usr/sbin/mariadbd

Dec 14 23:54:00 mariadb mariadbd[7885]: 2022-12-14 23:54:00 0 [Warning] You need to use --log-bin to make --expire-logs-days or --binlog-expire-logs-seconds work.
Dec 14 23:54:00 mariadb mariadbd[7885]: 2022-12-14 23:54:00 0 [Note] Server socket created on IP: '0.0.0.0'.
Dec 14 23:54:00 mariadb mariadbd[7885]: 2022-12-14 23:54:00 0 [Note] Server socket created on IP: '::'.
Dec 14 23:54:00 mariadb mariadbd[7885]: 2022-12-14 23:54:00 0 [Note] InnoDB: Buffer pool(s) load completed at 221214 23:54:00
Dec 14 23:54:00 mariadb mariadbd[7885]: 2022-12-14 23:54:00 0 [Note] /usr/sbin/mariadbd: ready for connections.
Dec 14 23:54:00 mariadb mariadbd[7885]: Version: '10.6.12-MariaDB-1:10.6.12+maria~deb11'  socket: '/run/mysqld/mysqld.sock'  port: 3306  mariadb.org binary distributi>
Dec 14 23:54:00 mariadb systemd[1]: Started MariaDB 10.6.12 Database Staging.
Dec 14 23:54:00 mariadb /etc/mysql/debian-start[7901]: Upgrading MySQL tables if necessary.
Dec 14 23:54:00 mariadb /etc/mysql/debian-start[7912]: Checking for insecure root accounts.
Dec 14 23:54:00 mariadb /etc/mysql/debian-start[7916]: Triggering myisam-recover for all MyISAM tables and aria-recover for all Aria tables

Step 6: Install Secure MariaDB 10.6

For security reasons, run the provided script to secure your MariaDB 10.6 installation, Follow the prompts to configure settings like setting a root password, removing anonymous users, disallowing remote root login, and removing the test database. These steps help enhance the security of your MariaDB 10.6 installation.

- Advertisement -
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 7: Check MariaDB Version

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

samm@mariadb:~$ mysql -u root -p
Enter password: [Your password]
Welcome to the MariaDB monitor.  Commands end with ; or g.
Your MariaDB connection id is 129
Server version: 10.6.11-MariaDB-1:10.6.11+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.6.12-MariaDB-1:10.6.11+maria~deb11 |
+---------------------------------------+
1 row in set (0.000 sec)

Step 8: Basic MariaDB Commands

Before you start using MariaDB, here some basic commands:

To access the MariaDB shell, use:

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

MariaDB Create Database

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

#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;

#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

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.6

Depending on your requirements, you can configure MariaDB 10.6 for optimal performance. Open the configuration file:

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

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

MariaDB 10.6 Clean up

To completely remove MariaDB, run the following commands.

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

Conclusion

Congratulations! You’ve successfully installed MariaDB 10.6 on your Debian 11 system. You now have a powerful and feature-rich relational database management system at your disposal. Whether you’re developing applications, managing data, or building websites, MariaDB’s capabilities will undoubtedly prove to be invaluable. Remember to keep your MariaDB installation updated and follow best security practices to ensure the safety and integrity of your data. With MariaDB 10.6 up and running, you’re well-equipped to manage and optimize your databases efficiently.

Also Read Our Other Guides :

  • How To Install MariaDB 10.9 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

Finally, now you have learned how to install MariaDB 10.6 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 Config Thumbor on Debian 10
Next Article How To Install and Use Docker Compose on Centos 7
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 MongoDB 6.0 on Debian 10 & 11
Debian
How To Install Redis on Debian 11 Server
Debian

You Might Also Like

Debian

How To Install Debian 11 (Bullseye) Server with Pictures

12 Min Read
Debian

How To Install MySQL 8.0 on Debian 11

14 Min Read
Ubuntu

How To Install DBeaver Community on Ubuntu 22.04

7 Min Read
Ubuntu

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

20 Min Read
Debian

How To Install MariaDB 10.9 on Debian 11 Server

17 Min Read
Debian

How To Install Apache Solr 9.1 on Debian 11

9 Min Read
Debian

Initial Setup Debian 11 Server: Secure and Efficient

17 Min Read
Rocky Linux

How To Install MySQL 8.0 on Rocky Linux 9

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?