How to install MariaDB 10.6 on Rocky Linux 8.6

To Install MariaDB 10.6 on Rocky Linux 8.6

Introduction:

MariaDB is a community-developed fork of MySQL. It is developed to maintain high compatibility with MySQL. It also includes the XtraDB feature for replacing the InnoDB.

Installation Steps:

Step1: Check the Oracle Linux version by using the below command

[root@linuxhelp ~]# cat /etc/os-release 
NAME="Rocky Linux"
VERSION="8.6 (Green Obsidian)"
ID="rocky"
ID_LIKE="rhel centos fedora"
VERSION_ID="8.6"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Rocky Linux 8.6 (Green Obsidian)"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:rocky:rocky:8:GA"
HOME_URL="https://rockylinux.org/"
BUG_REPORT_URL="https://bugs.rockylinux.org/"
ROCKY_SUPPORT_PRODUCT="Rocky Linux"
ROCKY_SUPPORT_PRODUCT_VERSION="8"
REDHAT_SUPPORT_PRODUCT="Rocky Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="8"

Step 2: Updating the System by using the below Command

[root@linuxhelp ~]# dnf update -y
Rocky Linux 8 - AppStream                                                       5.6 kB/s | 4.8 kB     00:00    
Rocky Linux 8 - AppStream                                                       3.5 MB/s |  11 MB     00:03    
Rocky Linux 8 - BaseOS                                                          5.2 kB/s | 4.3 kB     00:00    
Rocky Linux 8 - BaseOS                                                          3.4 MB/s | 7.9 MB     00:02    
Rocky Linux 8 - Extras                                                          4.3 kB/s | 3.5 kB     00:00    
Rocky Linux 8 - Extras                                                           12 kB/s |  12 kB     00:01    
Extra Packages for Enterprise Linux 8 - x86_64                                   11 kB/s | 8.6 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                                  4.0 MB/s |  13 MB     00:03    
Extra Packages for Enterprise Linux Modular 8 - x86_64                          9.4 kB/s | 9.4 kB     00:00    
Extra Packages for Enterprise Linux Modular 8 - x86_64                          568 kB/s | 733 kB     00:01    
Remi's Modular repository for Enterprise Linux 8 - x86_64                       690  B/s | 833  B     00:01    
Remi's Modular repository for Enterprise Linux 8 - x86_64                       460 kB/s | 1.1 MB     00:02    
Safe Remi's RPM repository for Enterprise Linux 8 - x86_64                      704  B/s | 833  B     00:01    
Safe Remi's RPM repository for Enterprise Linux 8 - x86_64                      834 kB/s | 2.3 MB     00:02    
Dependencies resolved.
================================================================================================================
 Package                                 Arch   Version                                      Repository    Size
================================================================================================================
Installing:
 kernel                                  x86_64 4.18.0-372.26.1.el8_6                        baseos       8.1 M
Upgrading:
 NetworkManager                          x86_64 1:1.36.0-7.el8_6                             baseos       2.3 M
 NetworkManager-adsl                     x86_64 1:1.36.0-7.el8_6                             baseos       148 k
 NetworkManager-bluetooth                x86_64 1:1.36.0-7.el8_6                             baseos       174 k
 NetworkManager-config-server            noarch 1:1.36.0-7.el8_6                             baseos       135 k
 NetworkManager-libnm                    x86_64 1:1.36.0-7.el8_6                             baseos       1.8 M
 NetworkManager-team                     x86_64 1:1.36.0-7.el8_6                             baseos       152 k
 NetworkManager-tui                      x86_64 1:1.36.0-7.el8_6                             baseos       345 k
 NetworkManager-wifi                     x86_64 1:1.36.0-7.el8_6                             baseos       193 k
 NetworkManager-wwan                     x86_64 1:1.36.0-7.el8_6                             baseos       180 k
                                             
  xorg-x11-server-Xwayland-21.1.3-2.el8_6.3.x86_64                                                              
  xorg-x11-server-common-1.20.11-5.el8_6.2.x86_64                                                               
  xz-5.2.4-4.el8_6.x86_64                                                                                       
  xz-libs-5.2.4-4.el8_6.x86_64                                                                                  
Installed:
  grub2-tools-efi-1:2.02-123.el8_6.8.rocky.0.2.x86_64        kernel-4.18.0-372.26.1.el8_6.x86_64               
  kernel-core-4.18.0-372.26.1.el8_6.x86_64                   kernel-modules-4.18.0-372.26.1.el8_6.x86_64       
  libatomic-8.5.0-10.1.el8_6.x86_64                         

Complete!

Step 3: once updated the packages,Reboot the system, and login again to verify all packages have been updated by using the below Commands.

[root@linuxhelp ~]# sudo init 6

Step 4 : Add the MariaDB Repository by using the below Command

[root@linuxhelp ~]# dnf module list mariadb
Rocky Linux 8 - AppStream                                                       5.0 kB/s | 4.8 kB     00:00    
Rocky Linux 8 - AppStream                                                       7.9 MB/s |  11 MB     00:01    
Rocky Linux 8 - BaseOS                                                          4.7 kB/s | 4.3 kB     00:00    
Rocky Linux 8 - BaseOS                                                          5.7 MB/s | 7.9 MB     00:01    
Rocky Linux 8 - Extras                                                          3.9 kB/s | 3.5 kB     00:00    
Rocky Linux 8 - Extras                                                           12 kB/s |  12 kB     00:01    
Extra Packages for Enterprise Linux 8 - x86_64                                   10 kB/s | 7.8 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                                  3.5 MB/s |  13 MB     00:03    
Extra Packages for Enterprise Linux Modular 8 - x86_64                           12 kB/s | 9.9 kB     00:00    
Remi's Modular repository for Enterprise Linux 8 - x86_64                       721  B/s | 833  B     00:01    
Remi's Modular repository for Enterprise Linux 8 - x86_64                       468 kB/s | 1.1 MB     00:02    
Safe Remi's RPM repository for Enterprise Linux 8 - x86_64                      717  B/s | 833  B     00:01    
Safe Remi's RPM repository for Enterprise Linux 8 - x86_64                      862 kB/s | 2.3 MB     00:02    
Rocky Linux 8 - AppStream
Name                  Stream                 Profiles                                Summary                    
mariadb               10.3 [d]               client, galera, server [d]              MariaDB Module             
mariadb               10.5                   client, galera, server [d]              MariaDB Module             

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

step 5: Create a MariaDB repo file by using the below Command

[root@linuxhelp ~]# vim /etc/yum.repos.d/mariadb.repo


[mariadb]

name = MariaDB

baseurl = http://yum.mariadb.org/10.6/rhel8-amd64

module_hotfixes=1

gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB

gpgcheck=1

Step 6: Add the repository, you can install MariaDB on your server. To do so run the command below.

[root@linuxhelp ~]# dnf update

MariaDB                                                                         215 kB/s | 587 kB     00:02    
Last metadata expiration check: 0:00:01 ago on Tue 27 Sep 2022 04:34:23 PM EDT.
Dependencies resolved.
Nothing to do.
Complete!
[root@linuxhelp ~]# dnf install mariadb-server mariadb

Last metadata expiration check: 0:00:20 ago on Tue 27 Sep 2022 04:34:23 PM EDT.
Dependencies resolved.
===============================================================================================================
 Package                      Architecture         Version                       Repository               Size
===============================================================================================================
Installing:
 MariaDB-client               x86_64               10.6.10-1.el8                 mariadb                  15 M
 MariaDB-server               x86_64               10.6.10-1.el8                 mariadb                  25 M
Installing dependencies:
 MariaDB-common               x86_64               10.6.10-1.el8                 mariadb                  88 k
 MariaDB-shared               x86_64               10.6.10-1.el8                 mariadb                 120 k
 galera-4                     x86_64               26.4.12-1.el8                 mariadb                  13 M
 socat                        x86_64               1.7.4.1-1.el8                 appstream               322 k

Transaction Summary
===============================================================================================================
Install  6 Packages

Total download size: 54 M
Installed size: 210 M
Is this ok [y/N]: y
Downloading Packages:
(1/6): socat-1.7.4.1-1.el8.x86_64.rpm                                          943 kB/s | 322 kB     00:00    
(2/6): MariaDB-common-10.6.10-1.el8.x86_64.rpm                                  73 kB/s |  88 kB     00:01    
(3/6): MariaDB-shared-10.6.10-1.el8.x86_64.rpm                                 108 kB/s | 120 kB     00:01    
(4/6): MariaDB-client-10.6.10-1.el8.x86_64.rpm                                 4.0 MB/s |  15 MB     00:03    
(5/6): galera-4-26.4.12-1.el8.x86_64.rpm                                       2.5 MB/s |  13 MB     00:05    
(6/6): MariaDB-server-10.6.10-1.el8.x86_64.rpm                                 1.8 MB/s |  25 MB     00:13    
---------------------------------------------------------------------------------------------------------------
Total                                                                          3.6 MB/s |  54 MB     00:14     
MariaDB                                                                        8.3 kB/s | 8.2 kB     00:00    
Importing GPG key 0x1BB943DB:
 Userid     : "MariaDB Package Signing Key <package-signing-key@mariadb.org>"
 Fingerprint: 1993 69E5 404B D5FC 7D2F E43B CBCB 082A 1BB9 43DB
 From       : https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
Is this ok [y/N]: y
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                       1/1 
  Running scriptlet: MariaDB-shared-10.6.10-1.el8.x86_64                                                   1/6 
  Installing       : MariaDB-shared-10.6.10-1.el8.x86_64                                                   1/6 
  Running scriptlet: MariaDB-shared-10.6.10-1.el8.x86_64                                                   1/6 
  Running scriptlet: MariaDB-common-10.6.10-1.el8.x86_64                                                   2/6 
  Installing       : MariaDB-common-10.6.10-1.el8.x86_64                                                   2/6 
  Running scriptlet: MariaDB-common-10.6.10-1.el8.x86_64                                                   2/6 
  Running scriptlet: MariaDB-client-10.6.10-1.el8.x86_64                                                   3/6 
  Installing       : MariaDB-client-10.6.10-1.el8.x86_64                                                   3/6 
  Running scriptlet: MariaDB-client-10.6.10-1.el8.x86_64                                                   3/6 
  Installing       : socat-1.7.4.1-1.el8.x86_64                                                            4/6 
  Running scriptlet: galera-4-26.4.12-1.el8.x86_64                                                         5/6 
  Installing       : galera-4-26.4.12-1.el8.x86_64                                                         5/6 
  Running scriptlet: galera-4-26.4.12-1.el8.x86_64                                                         5/6 
  Running scriptlet: MariaDB-server-10.6.10-1.el8.x86_64                                                   6/6 
  Installing       : MariaDB-server-10.6.10-1.el8.x86_64                                                   6/6 
  Installed:
  MariaDB-client-10.6.10-1.el8.x86_64 MariaDB-common-10.6.10-1.el8.x86_64 MariaDB-server-10.6.10-1.el8.x86_64
  MariaDB-shared-10.6.10-1.el8.x86_64 galera-4-26.4.12-1.el8.x86_64       socat-1.7.4.1-1.el8.x86_64           
  completed !

Step 7: Once the installation is complete, start the MariaDB service and enable it to run on system boot.


 [root@linuxhelp ~]# systemctl start mariadb
[root@linuxhelp ~]# systemctl enable mariadb
Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service → /usr/lib/systemd/system/mariadb.service.
[root@linuxhelp ~]# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.6.10-MariaDB MariaDB Server

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)]> 

Conclusion:

We have reached the end of this article. In this guide, we have walked you through the steps required to Install MariaDB 10.6 on Rocky Linux 8.6.Your feedback is much welcome.

FAQ
Q
What is the command to switch to MariaDB?
A
Enter the MySQL command to call the MariaDB by the following command

# mysql
Q
What is the use of a check database and table size in MariaDB?
A
MariaDB is a community-developed fork of MySQL. It is designed to maintain high compatibility with MySQL. It includes the XtraDB feature for replacing the InnoDB.
Q
How to quit MariaDB?
A
To quit MariaDB, enter the following command.

MariaDB [(none)]> q
Q
How to check all the table sizes from the databases?
A
SELECT table_name "Table Name", table_rows "Rows Count", round(((data_length + index_length)/1024/1024),2)
"Table Size (MB)" FROM information_schema.TABLES WHERE table_schema = "mysql";
Q
What is the command to check the MariaDB version you have installed?
A
The command to check the MariaDB version you have installed by below the command

# mysql -v