Install MariaDB 11.4 on RHEL 9 | CentOS Stream 9

In this article we explain how one can install and use MariaDB 11.4 on RHEL 9 | CentOS Stream 9. MariaDB is an open source relational database which provides an SQL interface for accessing data. The latest versions of MariaDB include support for GIS and JSON. MariaDB is a fork of MySQL database, with its active development under open source community.

MariaDB latest packages are not available in Red Hat or CentOS provided RPM repositories. We’ll have to add MariaDB provided repository then install the packages from there. I believe you can also use Software Collections repository, but I didn’t try using it.

Add MariaDB 11.4 repository to RHEL 9 | CentOS Stream 9

Let’s add MariaDB 11.4 YUM repository to our RHEL 9 | CentOS Stream 9 system. For these repositories, check out the mirror list and pick the one nearest to you, then paste it inside of the following commands:

CentOS Stream 9:

sudo tee /etc/yum.repos.d/mariadb.repo<<EOF
# MariaDB 11.4 CentOS repository list - created 2025-05-07 20:57 UTC
# https://mariadb.org/download/
[mariadb]
name = MariaDB
# rpm.mariadb.org is a dynamic mirror if your preferred mirror goes offline. See https://mariadb.org/mirrorbits/ for details.
# baseurl = https://rpm.mariadb.org/11.4/centos/$releasever/$basearch
baseurl = https://mariadb.mirror.digitalpacific.com.au/yum/11.4/centos/$releasever/$basearch
# gpgkey = https://rpm.mariadb.org/RPM-GPG-KEY-MariaDB
gpgkey = https://mariadb.mirror.digitalpacific.com.au/yum/RPM-GPG-KEY-MariaDB
gpgcheck = 1
EOF

RHEL 9:

sudo tee /etc/yum.repos.d/mariadb.repo<<EOF
# MariaDB 11.4 RedHatEnterpriseLinux repository list - created 2025-05-07 20:41 UTC
# https://mariadb.org/download/
[mariadb]
name = MariaDB
# rpm.mariadb.org is a dynamic mirror if your preferred mirror goes offline. See https://mariadb.org/mirrorbits/ for details.
# baseurl = https://rpm.mariadb.org/11.4/rhel/$releasever/$basearch
baseurl = https://mariadb.mirror.digitalpacific.com.au/yum/11.4/rhel/$releasever/$basearch
# gpgkey = https://rpm.mariadb.org/RPM-GPG-KEY-MariaDB
gpgkey = https://mariadb.mirror.digitalpacific.com.au/yum/RPM-GPG-KEY-MariaDB
gpgcheck = 1
EOF

Once the repository is added update package cache index to confirm it is working.

sudo dnf clean all
sudo dnf makecache

List available repositories:

$ sudo yum repolist

Sample Output:

Updating Subscription Management repositories.
repo id                                                                                  repo name
mariadb                                                                                  MariaDB
rhel-9-for-x86_64-appstream-rpms                                                         Red Hat Enterprise Linux 9 for x86_64 - AppStream (RPMs)
rhel-9-for-x86_64-baseos-rpms                                                            Red Hat Enterprise Linux 9 for x86_64 - BaseOS (RPMs)

Agree to importation of repository GPG key:

warning: rpmts_HdrFromFdno: Header V4 DSA/SHA1 Signature, key ID 1bb943db: NOKEY
Retrievi key from https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
Importing GPG key 0x1BB943DB:
 Userid: "MariaDB Package Signing Key <[email protected]>"
 From  : https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
Is this ok [y/N]: y

Install MariaDB 11.4 on RHEL 9 | CentOS Stream 9

With the repository added and confirmed to be working we can begin installation of MariaDB 11.4 on CentOS Stream 9 | RHEL 9 system.

sudo dnf install MariaDB-server MariaDB-client 

Accept the installation:

Updating Subscription Management repositories.
Last metadata expiration check: 0:05:46 ago on Wed 07 May 2025 11:43:47 PM EAT.
Dependencies resolved.
==========================================================================================================================================================================================================
 Package                                            Architecture                       Version                                         Repository                                                    Size
==========================================================================================================================================================================================================
Installing:
 MariaDB-client                                     x86_64                             11.4.5-1.el9                                    mariadb                                                      9.3 M
 MariaDB-server                                     x86_64                             11.4.5-1.el9                                    mariadb                                                       19 M
Installing dependencies:
 MariaDB-common                                     x86_64                             11.4.5-1.el9                                    mariadb                                                       89 k
 MariaDB-shared                                     x86_64                             11.4.5-1.el9                                    mariadb                                                      130 k
 boost-program-options                              x86_64                             1.75.0-8.el9                                    rhel-9-for-x86_64-appstream-rpms                             108 k
 galera-4                                           x86_64                             26.4.21-1.el9                                   mariadb                                                      1.4 M
 perl-AutoLoader                                    noarch                             5.74-481.el9                                    rhel-9-for-x86_64-appstream-rpms                              21 k
 perl-B                                             x86_64                             1.80-481.el9                                    rhel-9-for-x86_64-appstream-rpms                             184 k
 perl-Carp                                          noarch                             1.50-460.el9                                    rhel-9-for-x86_64-appstream-rpms                              31 k
 perl-Class-Struct                                  noarch                             0.66-481.el9                                    rhel-9-for-x86_64-appstream-rpms                              22 k
 perl-DBI                                           x86_64                             1.643-9.el9                                     rhel-9-for-x86_64-appstream-rpms                             729 k
 perl-Data-Dumper                                   x86_64                             2.174-462.el9                                   rhel-9-for-x86_64-appstream-rpms                              59 k
 perl-Digest                                        noarch                             1.19-4.el9                                      rhel-9-for-x86_64-appstream-rpms                              29 k
 perl-Digest-MD5                                    x86_64                             2.58-4.el9                                      rhel-9-for-x86_64-appstream-rpms                              39 k
 perl-DynaLoader                                    x86_64                             1.47-481.el9                                    rhel-9-for-x86_64-appstream-rpms                              26 k
 perl-Encode                                        x86_64                             4:3.08-462.el9                                  rhel-9-for-x86_64-appstream-rpms                             1.7 M
 perl-Errno                                         x86_64                             1.30-481.el9                                    rhel-9-for-x86_64-appstream-rpms                              15 k
 perl-Exporter                                      noarch                             5.74-461.el9                                    rhel-9-for-x86_64-appstream-rpms                              34 k
 perl-Fcntl                                         x86_64                             1.13-481.el9                                    rhel-9-for-x86_64-appstream-rpms                              22 k
 perl-File-Basename                                 noarch                             2.85-481.el9                                    rhel-9-for-x86_64-appstream-rpms                              17 k
 perl-File-Copy                                     noarch                             2.34-481.el9                                    rhel-9-for-x86_64-appstream-rpms                              20 k
 perl-File-Path                                     noarch                             2.18-4.el9                                      rhel-9-for-x86_64-appstream-rpms                              38 k
 perl-File-Temp                                     noarch                             1:0.231.100-4.el9                               rhel-9-for-x86_64-appstream-rpms                              63 k
 perl-File-stat                                     noarch                             1.09-481.el9                                    rhel-9-for-x86_64-appstream-rpms                              17 k
 perl-FileHandle                                    noarch                             2.03-481.el9                                    rhel-9-for-x86_64-appstream-rpms                              16 k
 perl-Getopt-Long                                   noarch                             1:2.52-4.el9                                    rhel-9-for-x86_64-appstream-rpms                              64 k
 perl-Getopt-Std                                    noarch                             1.12-481.el9                                    rhel-9-for-x86_64-appstream-rpms                              16 k
 perl-HTTP-Tiny                                     noarch                             0.076-462.el9                                   rhel-9-for-x86_64-appstream-rpms                              57 k
 perl-IO                                            x86_64                             1.43-481.el9                                    rhel-9-for-x86_64-appstream-rpms                              92 k
 perl-IO-Socket-IP                                  noarch                             0.41-5.el9                                      rhel-9-for-x86_64-appstream-rpms                              45 k
 perl-IO-Socket-SSL                                 noarch                             2.073-2.el9                                     rhel-9-for-x86_64-appstream-rpms                             221 k
 perl-IPC-Open3                                     noarch                             1.21-481.el9                                    rhel-9-for-x86_64-appstream-rpms                              24 k
 perl-MIME-Base64                                   x86_64                             3.16-4.el9                                      rhel-9-for-x86_64-appstream-rpms                              34 k
 perl-Math-BigInt                                   noarch                             1:1.9998.18-460.el9                             rhel-9-for-x86_64-appstream-rpms                             194 k
 perl-Math-Complex                                  noarch                             1.59-481.el9                                    rhel-9-for-x86_64-appstream-rpms                              47 k
 perl-Mozilla-CA                                    noarch                             20200520-6.el9                                  rhel-9-for-x86_64-appstream-rpms                              14 k
 perl-Net-SSLeay                                    x86_64                             1.94-1.el9                                      rhel-9-for-x86_64-appstream-rpms                             418 k
 perl-POSIX                                         x86_64                             1.94-481.el9                                    rhel-9-for-x86_64-appstream-rpms                              98 k
 perl-PathTools                                     x86_64                             3.78-461.el9                                    rhel-9-for-x86_64-appstream-rpms                              92 k
 perl-Pod-Escapes                                   noarch                             1:1.07-460.el9                                  rhel-9-for-x86_64-appstream-rpms                              22 k
 perl-Pod-Perldoc                                   noarch                             3.28.01-461.el9                                 rhel-9-for-x86_64-appstream-rpms                              92 k
 perl-Pod-Simple                                    noarch                             1:3.42-4.el9                                    rhel-9-for-x86_64-appstream-rpms                             229 k
 perl-Pod-Usage                                     noarch                             4:2.01-4.el9                                    rhel-9-for-x86_64-appstream-rpms                              43 k
 perl-Scalar-List-Utils                             x86_64                             4:1.56-462.el9                                  rhel-9-for-x86_64-appstream-rpms                              75 k
 perl-SelectSaver                                   noarch                             1.02-481.el9                                    rhel-9-for-x86_64-appstream-rpms                              12 k
 perl-Socket                                        x86_64                             4:2.031-4.el9                                   rhel-9-for-x86_64-appstream-rpms                              58 k
 perl-Storable                                      x86_64                             1:3.21-460.el9                                  rhel-9-for-x86_64-appstream-rpms                              98 k
 perl-Symbol                                        noarch                             1.08-481.el9                                    rhel-9-for-x86_64-appstream-rpms                              14 k
 perl-Sys-Hostname                                  x86_64                             1.23-481.el9                                    rhel-9-for-x86_64-appstream-rpms                              19 k
 perl-Term-ANSIColor                                noarch                             5.01-461.el9                                    rhel-9-for-x86_64-appstream-rpms                              51 k
 perl-Term-Cap                                      noarch                             1.17-460.el9                                    rhel-9-for-x86_64-appstream-rpms                              24 k
 perl-Text-ParseWords                               noarch                             3.30-460.el9                                    rhel-9-for-x86_64-appstream-rpms                              18 k
 perl-Text-Tabs+Wrap                                noarch                             2013.0523-460.el9                               rhel-9-for-x86_64-appstream-rpms                              25 k
 perl-Time-Local                                    noarch                             2:1.300-7.el9                                   rhel-9-for-x86_64-appstream-rpms                              37 k
 perl-URI                                           noarch                             5.09-3.el9                                      rhel-9-for-x86_64-appstream-rpms                             125 k
 perl-base                                          noarch                             2.27-481.el9                                    rhel-9-for-x86_64-appstream-rpms                              16 k
 perl-constant                                      noarch                             1.33-461.el9                                    rhel-9-for-x86_64-appstream-rpms                              25 k
 perl-if                                            noarch                             0.60.800-481.el9                                rhel-9-for-x86_64-appstream-rpms                              14 k
 perl-interpreter                                   x86_64                             4:5.32.1-481.el9                                rhel-9-for-x86_64-appstream-rpms                              73 k
 perl-libnet                                        noarch                             3.13-4.el9                                      rhel-9-for-x86_64-appstream-rpms                             134 k
 perl-libs                                          x86_64                             4:5.32.1-481.el9                                rhel-9-for-x86_64-appstream-rpms                             2.2 M
 perl-mro                                           x86_64                             1.23-481.el9                                    rhel-9-for-x86_64-appstream-rpms                              29 k
 perl-overload                                      noarch                             1.31-481.el9                                    rhel-9-for-x86_64-appstream-rpms                              46 k
 perl-overloading                                   noarch                             0.02-481.el9                                    rhel-9-for-x86_64-appstream-rpms                              13 k
 perl-parent                                        noarch                             1:0.238-460.el9                                 rhel-9-for-x86_64-appstream-rpms                              16 k
 perl-podlators                                     noarch                             1:4.14-460.el9                                  rhel-9-for-x86_64-appstream-rpms                             118 k
 perl-subs                                          noarch                             1.03-481.el9                                    rhel-9-for-x86_64-appstream-rpms                              12 k
 perl-vars                                          noarch                             1.05-481.el9                                    rhel-9-for-x86_64-appstream-rpms                              13 k
Installing weak dependencies:
 MariaDB-client-compat                              noarch                             11.4.5-1.el9                                    mariadb                                                       11 k
 perl-NDBM_File                                     x86_64                             1.15-481.el9                                    rhel-9-for-x86_64-appstream-rpms                              23 k
 socat                                              x86_64                             1.7.4.1-6.el9                                   rhel-9-for-x86_64-appstream-rpms                             308 k

Transaction Summary
==========================================================================================================================================================================================================
Install  71 Packages

Total download size: 38 M
Installed size: 266 M
Is this ok [y/N]: y

Agree to import the GPG Keys when asked:

Importing GPG key 0x1BB943DB:
 Userid     : "MariaDB Package Signing Key <[email protected]>"
 Fingerprint: 1993 69E5 404B D5FC 7D2F E43B CBCB 082A 1BB9 43DB
 From       : https://mariadb.mirror.digitalpacific.com.au/yum/RPM-GPG-KEY-MariaDB
Is this ok [y/N]: y
Key imported successfully
Importing GPG key 0xC74CD1D8:
 Userid     : "MariaDB Signing Key <[email protected]>"
 Fingerprint: 177F 4010 FE56 CA33 3630 0305 F165 6F24 C74C D1D8
 From       : https://mariadb.mirror.digitalpacific.com.au/yum/RPM-GPG-KEY-MariaDB
Is this ok [y/N]: y
Key imported successfully
Red Hat Enterprise Linux 9 for x86_64 - AppStream (RPMs)                                                                                                                  3.5 MB/s | 3.6 kB     00:00
Importing GPG key 0xFD431D51:
 Userid     : "Red Hat, Inc. (release key 2) <[email protected]>"
 Fingerprint: 567E 347A D004 4ADE 55BA 8A5F 199E 2F91 FD43 1D51
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Is this ok [y/N]: y
Key imported successfully
Importing GPG key 0x5A6340B3:
 Userid     : "Red Hat, Inc. (auxiliary key 3) <[email protected]>"
 Fingerprint: 7E46 2425 8C40 6535 D56D 6F13 5054 E4A4 5A63 40B3
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Is this ok [y/N]: y

Start and enable the database service.

sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service

The service should be running:

Secure MariaDB Database Server

The final step is to secure our database server installation by setting the root user password, removing test database, anonymous users, and disabling remote root user login.

$ 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] n
 ... skipping.

You already have your root account protected, so you can safely answer 'n'.

Change the root password? [Y/n] Y
New password:
Re-enter new 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!

Try authenticating to MariDB shell using the set password for the root user.

mariadb -u root -p

Sample:

We have successfully installed MariaDB 11.4 on CentOS Stream 9 | RHEL 9, started the service and secure the database server.

More guides:

Join our Linux and open source community. Subscribe to our newsletter for tips, tricks, and collaboration opportunities!

Recent Post

Unlock the Right Solutions with Confidence

At CloudSpinx, we don’t just offer services - we deliver clarity, direction, and results. Whether you're navigating cloud adoption, scaling infrastructure, or solving DevOps challenges, our seasoned experts help you make smart, strategic decisions with total confidence. Let us turn complexity into opportunity and bring your vision to life.

Leave a Comment

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

Related Post

CentOS 8 hit its EOL date in December 31st, 2021, a strategic point in the Red Hat Enterprise Linux (RHEL) […]

Setting the correct system time and timezone is a fundamental skill for administering any Linux server, especially on enterprise versions […]

Security Enhanced Linux (SELinux) provides an additional layer of system security, mostly adopted in Red Hat based Linux systems. SELinux […]

Let's Connect

Unleash the full potential of your business with CloudSpinx. Our expert solutions specialists are standing by to answer your questions and tailor a plan that perfectly aligns with your unique needs.
You will get a response from our solutions specialist within 12 hours
We understand emergencies can be stressful. For immediate assistance, chat with us now

Contact CloudSpinx today!

Download CloudSpinx Profile

Discover the full spectrum of our expertise and services by downloading our detailed Company Profile. Simply enter your first name, last name, and email address.