Install MariaDB Server 10.5 on CentOS 8 - CentLinux

Latest

Sunday, 31 May 2020

Install MariaDB Server 10.5 on CentOS 8

Install MariaDB Server 10.5 on CentOS 8

In this article, you will learn how to install MariaDB Server 10.5 on CentOS 8 and configure admin users and database security.

 

This Article Provides:

 

What is MariaDB Server? :

MariaDB is a free and open source RDBMS (Relational Database Management System). MariaDB is a fork of MySQL database maintained by some of the original developers of MySQL project. Just like its predecessor, MariaDB is mostly used as a backend database for PHP based servers. MariaDB is also used by many FOSS (Free and Open Source Software) utilities as their data repository.

MariaDB Server is highly scalable and can be used as Stand Alone or Galera based MariaDB Cluster environments.

MariaDB Server 10.5.3 is released on 12-May-2020 with many new features and some major changes. It is the latest release at the time of this writing.

 

New Features in MariaDB Server 10.5:

Some of the changes and features in MariaDB Server 10.5 are:

  • All binaries previously beginning with mysql now begin with mariadb, with symlinks for the corresponding mysql command
  • S3 Storage Engine - to archive MariaDB tables in Amazon S3, or any third-party public or private cloud that implements S3 API
  • Both S3 tables and partitioned S3 tables are discoverable. This means that if you create a partitioned S3 table, both the partitioned table and its partitions can be directly used by another server that has access to the S3 storage
  • New privileges were added by splitting the SUPER privilege, so that more fine grained tuning of what each user can do can be applied
  • Speed up binary row logging code
  • Improve connect speed (up to 25%)

You can see the complete list of new features in MariaDB 10.5.3 at MariaDB Official website.

 

Update CentOS 8 Software Packages:

Connect to mariadb-01.centlinux.com as root user by using a ssh tool.

It is a best practice to always update the Linux software packages before installing anything new.

[root@mariadb-01 ~]# dnf update -y
Last metadata expiration check: 0:02:32 ago on Fri 29 May 2020 01:43:09 PM PKT.
Dependencies resolved.
Nothing to do.
Complete!

Our Linux machine is already up-to-date.

 

Install MariaDB Yum Repository in CentOS 8:

MariaDB Server 10.5.3 is the latest release therefore it is not available in CentOS 8 yum repositories.

MariaDB provides an official yum repository, that we can use to install MariaDB Server 10.5 on CentOS 8.

Create a yum repository file as follows.

[root@mariadb-01 ~]# vi /etc/yum.repos.d/MariaDB.repo

Add following directives in this file.

# MariaDB 10.5 CentOS repository list - created 2020-05-29 08:37 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.5/centos8-amd64
module_hotfixes=1
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

Build cache for MariaDB yum repository.

[root@mariadb-01 ~]# dnf makecache
CentOS-8 - AppStream                            7.8 kB/s | 4.3 kB     00:00
CentOS-8 - Base                                 292  B/s | 3.9 kB     00:13
CentOS-8 - Extras                               3.7 kB/s | 1.5 kB     00:00
MariaDB                                         164 kB/s | 512 kB     00:03
Metadata cache created.

 

Install MariaDB Server 10.5 on CentOS 8:

We have added the MariaDB yum repository, now we can easily install MariaDB Server using dnf command.

[root@mariadb-01 ~]# dnf install -y MariaDB-server
Last metadata expiration check: 0:01:56 ago on Fri 29 May 2020 01:47:59 PM PKT.
Dependencies resolved.
================================================================================
 Package                Arch   Version                          Repo       Size
================================================================================
Installing:
 MariaDB-server         x86_64 10.5.3-1.el8                     mariadb    26 M
Installing dependencies:
 boost-program-options  x86_64 1.66.0-6.el8                     AppStream 143 k
 perl-DBI               x86_64 1.641-3.module_el8.1.0+199+8f0a6bbd
                                                                AppStream 740 k
 perl-Digest            noarch 1.17-395.el8                     AppStream  27 k
 perl-Digest-MD5        x86_64 2.55-396.el8                     AppStream  37 k
 perl-Net-SSLeay        x86_64 1.88-1.el8                       AppStream 379 k
 perl-URI               noarch 1.73-3.el8                       AppStream 116 k
 perl-libnet            noarch 3.11-3.el8                       AppStream 121 k
 lsof                   x86_64 4.91-2.el8                       BaseOS    253 k
 perl-Carp              noarch 1.42-396.el8                     BaseOS     30 k
 perl-Data-Dumper       x86_64 2.167-399.el8                    BaseOS     58 k
 perl-Encode            x86_64 4:2.97-3.el8                     BaseOS    1.5 M
 perl-Errno             x86_64 1.28-416.el8                     BaseOS     76 k
 perl-Exporter          noarch 5.72-396.el8                     BaseOS     34 k
 perl-File-Path         noarch 2.15-2.el8                       BaseOS     38 k
 perl-File-Temp         noarch 0.230.600-1.el8                  BaseOS     63 k
 perl-Getopt-Long       noarch 1:2.50-4.el8                     BaseOS     63 k
 perl-HTTP-Tiny         noarch 0.074-1.el8                      BaseOS     58 k
 perl-IO                x86_64 1.38-416.el8                     BaseOS    141 k
 perl-MIME-Base64       x86_64 3.15-396.el8                     BaseOS     31 k
 perl-Math-BigInt       noarch 1:1.9998.11-7.el8                BaseOS    196 k
 perl-Math-Complex      noarch 1.59-416.el8                     BaseOS    108 k
 perl-PathTools         x86_64 3.74-1.el8                       BaseOS     90 k
 perl-Pod-Escapes       noarch 1:1.07-395.el8                   BaseOS     20 k
 perl-Pod-Perldoc       noarch 3.28-396.el8                     BaseOS     86 k
 perl-Pod-Simple        noarch 1:3.35-395.el8                   BaseOS    213 k
 perl-Pod-Usage         noarch 4:1.69-395.el8                   BaseOS     34 k
 perl-Scalar-List-Utils x86_64 3:1.49-2.el8                     BaseOS     68 k
 perl-Socket            x86_64 4:2.027-3.el8                    BaseOS     59 k
 perl-Storable          x86_64 1:3.11-3.el8                     BaseOS     98 k
 perl-Term-ANSIColor    noarch 4.06-396.el8                     BaseOS     46 k
 perl-Term-Cap          noarch 1.17-395.el8                     BaseOS     23 k
 perl-Text-ParseWords   noarch 3.30-395.el8                     BaseOS     18 k
 perl-Text-Tabs+Wrap    noarch 2013.0523-395.el8                BaseOS     24 k
 perl-Time-Local        noarch 1:1.280-1.el8                    BaseOS     34 k
 perl-Unicode-Normalize x86_64 1.25-396.el8                     BaseOS     82 k
 perl-constant          noarch 1.33-396.el8                     BaseOS     25 k
 perl-interpreter       x86_64 4:5.26.3-416.el8                 BaseOS    6.3 M
 perl-libs              x86_64 4:5.26.3-416.el8                 BaseOS    1.6 M
 perl-macros            x86_64 4:5.26.3-416.el8                 BaseOS     72 k
 perl-parent            noarch 1:0.237-1.el8                    BaseOS     20 k
 perl-podlators         noarch 4.11-1.el8                       BaseOS    118 k
 perl-threads           x86_64 1:2.21-2.el8                     BaseOS     61 k
 perl-threads-shared    x86_64 1.58-2.el8                       BaseOS     48 k
 rsync                  x86_64 3.1.3-6.el8                      BaseOS    405 k
 MariaDB-client         x86_64 10.5.3-1.el8                     mariadb    13 M
 MariaDB-common         x86_64 10.5.3-1.el8                     mariadb    87 k
 MariaDB-shared         x86_64 10.5.3-1.el8                     mariadb   115 k
 galera-4               x86_64 26.4.4-1.rhel8.0.el8             mariadb    13 M
Installing weak dependencies:
 perl-IO-Socket-IP      noarch 0.39-5.el8                       AppStream  47 k
 perl-IO-Socket-SSL     noarch 2.066-3.el8                      AppStream 297 k
 perl-Mozilla-CA        noarch 20160104-7.el8                   AppStream  15 k
Enabling module streams:
 perl-DBI                      1.641

Transaction Summary
================================================================================
Install  52 Packages

Total download size: 67 M
Installed size: 244 M
Downloading Packages:
(1/52): perl-Digest-1.17-395.el8.noarch.rpm     161 kB/s |  27 kB     00:00
(2/52): boost-program-options-1.66.0-6.el8.x86_ 526 kB/s | 143 kB     00:00
(3/52): perl-Digest-MD5-2.55-396.el8.x86_64.rpm 230 kB/s |  37 kB     00:00
(4/52): perl-IO-Socket-IP-0.39-5.el8.noarch.rpm 272 kB/s |  47 kB     00:00
(5/52): perl-Mozilla-CA-20160104-7.el8.noarch.r 147 kB/s |  15 kB     00:00
(6/52): perl-IO-Socket-SSL-2.066-3.el8.noarch.r 271 kB/s | 297 kB     00:01
(7/52): perl-Net-SSLeay-1.88-1.el8.x86_64.rpm   425 kB/s | 379 kB     00:00
(8/52): perl-DBI-1.641-3.module_el8.1.0+199+8f0 503 kB/s | 740 kB     00:01
(9/52): perl-URI-1.73-3.el8.noarch.rpm          717 kB/s | 116 kB     00:00
(10/52): perl-libnet-3.11-3.el8.noarch.rpm      638 kB/s | 121 kB     00:00
(11/52): perl-Carp-1.42-396.el8.noarch.rpm      1.1 kB/s |  30 kB     00:28
(12/52): perl-Data-Dumper-2.167-399.el8.x86_64. 1.7 kB/s |  58 kB     00:33
(13/52): lsof-4.91-2.el8.x86_64.rpm             5.5 kB/s | 253 kB     00:45
(14/52): perl-Errno-1.28-416.el8.x86_64.rpm     2.8 kB/s |  76 kB     00:26
(15/52): perl-File-Path-2.15-2.el8.noarch.rpm   8.0 kB/s |  38 kB     00:04
(16/52): perl-File-Temp-0.230.600-1.el8.noarch.  14 kB/s |  63 kB     00:04
(17/52): perl-Exporter-5.72-396.el8.noarch.rpm  1.4 kB/s |  34 kB     00:23
(18/52): perl-Getopt-Long-2.50-4.el8.noarch.rpm  14 kB/s |  63 kB     00:04
(19/52): perl-IO-1.38-416.el8.x86_64.rpm        9.6 kB/s | 141 kB     00:14
(20/52): perl-HTTP-Tiny-0.074-1.el8.noarch.rpm  1.8 kB/s |  58 kB     00:33
(21/52): perl-MIME-Base64-3.15-396.el8.x86_64.r 1.2 kB/s |  31 kB     00:26
(22/52): perl-Math-BigInt-1.9998.11-7.el8.noarc 5.2 kB/s | 196 kB     00:37
(23/52): perl-Math-Complex-1.59-416.el8.noarch. 3.1 kB/s | 108 kB     00:34
(24/52): perl-Encode-2.97-3.el8.x86_64.rpm       12 kB/s | 1.5 MB     02:09
(25/52): perl-Pod-Escapes-1.07-395.el8.noarch.r 963  B/s |  20 kB     00:21
(26/52): perl-PathTools-3.74-1.el8.x86_64.rpm   2.5 kB/s |  90 kB     00:36
(27/52): perl-Pod-Perldoc-3.28-396.el8.noarch.r 2.4 kB/s |  86 kB     00:36
(28/52): perl-Pod-Usage-1.69-395.el8.noarch.rpm 1.1 kB/s |  34 kB     00:31
(29/52): perl-Pod-Simple-3.35-395.el8.noarch.rp 4.0 kB/s | 213 kB     00:53
(30/52): perl-Scalar-List-Utils-1.49-2.el8.x86_ 1.5 kB/s |  68 kB     00:46
(31/52): perl-Socket-2.027-3.el8.x86_64.rpm     1.1 kB/s |  59 kB     00:54
(32/52): perl-Term-ANSIColor-4.06-396.el8.noarc 1.7 kB/s |  46 kB     00:27
(33/52): perl-Text-ParseWords-3.30-395.el8.noar 333 kB/s |  18 kB     00:00
(34/52): perl-Text-Tabs+Wrap-2013.0523-395.el8. 523 kB/s |  24 kB     00:00
(35/52): perl-Time-Local-1.280-1.el8.noarch.rpm 751 kB/s |  34 kB     00:00
(36/52): perl-Unicode-Normalize-1.25-396.el8.x8 1.1 MB/s |  82 kB     00:00
(37/52): perl-constant-1.33-396.el8.noarch.rpm  605 kB/s |  25 kB     00:00
(38/52): perl-interpreter-5.26.3-416.el8.x86_64 1.2 MB/s | 6.3 MB     00:05
(39/52): perl-libs-5.26.3-416.el8.x86_64.rpm    1.2 MB/s | 1.6 MB     00:01
(40/52): perl-macros-5.26.3-416.el8.x86_64.rpm  1.3 MB/s |  72 kB     00:00
(41/52): perl-parent-0.237-1.el8.noarch.rpm     405 kB/s |  20 kB     00:00
(42/52): perl-podlators-4.11-1.el8.noarch.rpm   2.1 MB/s | 118 kB     00:00
(43/52): perl-threads-2.21-2.el8.x86_64.rpm     1.2 MB/s |  61 kB     00:00
(44/52): perl-threads-shared-1.58-2.el8.x86_64. 1.0 MB/s |  48 kB     00:00
(45/52): rsync-3.1.3-6.el8.x86_64.rpm           1.1 MB/s | 405 kB     00:00
(46/52): perl-Term-Cap-1.17-395.el8.noarch.rpm  1.0 kB/s |  23 kB     00:23
(47/52): MariaDB-client-10.5.3-1.el8.x86_64.rpm 946 kB/s |  13 MB     00:13
(48/52): MariaDB-common-10.5.3-1.el8.x86_64.rpm  22 kB/s |  87 kB     00:03
(49/52): MariaDB-shared-10.5.3-1.el8.x86_64.rpm  42 kB/s | 115 kB     00:02
(50/52): perl-Storable-3.11-3.el8.x86_64.rpm    1.3 kB/s |  98 kB     01:14
(51/52): MariaDB-server-10.5.3-1.el8.x86_64.rpm 768 kB/s |  26 MB     00:35
(52/52): galera-4-26.4.4-1.rhel8.0.el8.x86_64.r 426 kB/s |  13 MB     00:32
--------------------------------------------------------------------------------
Total                                           208 kB/s |  67 MB     05:27
warning: /var/cache/dnf/mariadb-43de5445dbb1892a/packages/MariaDB-client-10.5.3-1.el8.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 1bb943db: NOKEY
MariaDB                                         6.8 kB/s | 8.2 kB     00:01
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
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1
  Installing       : perl-Exporter-5.72-396.el8.noarch                     1/52
  Installing       : perl-libs-4:5.26.3-416.el8.x86_64                     2/52
  Installing       : perl-Carp-1.42-396.el8.noarch                         3/52
  Installing       : perl-Scalar-List-Utils-3:1.49-2.el8.x86_64            4/52
  Installing       : perl-parent-1:0.237-1.el8.noarch                      5/52
  Running scriptlet: MariaDB-shared-10.5.3-1.el8.x86_64                    6/52
  Installing       : MariaDB-shared-10.5.3-1.el8.x86_64                    6/52
  Running scriptlet: MariaDB-shared-10.5.3-1.el8.x86_64                    6/52
  Running scriptlet: MariaDB-common-10.5.3-1.el8.x86_64                    7/52
  Installing       : MariaDB-common-10.5.3-1.el8.x86_64                    7/52
  Running scriptlet: MariaDB-common-10.5.3-1.el8.x86_64                    7/52
  Installing       : perl-Text-ParseWords-3.30-395.el8.noarch              8/52
  Running scriptlet: MariaDB-client-10.5.3-1.el8.x86_64                    9/52
  Installing       : MariaDB-client-10.5.3-1.el8.x86_64                    9/52
  Running scriptlet: MariaDB-client-10.5.3-1.el8.x86_64                    9/52
  Installing       : perl-Term-ANSIColor-4.06-396.el8.noarch              10/52
  Installing       : perl-macros-4:5.26.3-416.el8.x86_64                  11/52
  Installing       : perl-Errno-1.28-416.el8.x86_64                       12/52
  Installing       : perl-Socket-4:2.027-3.el8.x86_64                     13/52
  Installing       : perl-Text-Tabs+Wrap-2013.0523-395.el8.noarch         14/52
  Installing       : perl-Unicode-Normalize-1.25-396.el8.x86_64           15/52
  Installing       : perl-File-Path-2.15-2.el8.noarch                     16/52
  Installing       : perl-IO-1.38-416.el8.x86_64                          17/52
  Installing       : perl-PathTools-3.74-1.el8.x86_64                     18/52
  Installing       : perl-constant-1.33-396.el8.noarch                    19/52
  Installing       : perl-threads-1:2.21-2.el8.x86_64                     20/52
  Installing       : perl-threads-shared-1.58-2.el8.x86_64                21/52
  Installing       : perl-interpreter-4:5.26.3-416.el8.x86_64             22/52
  Installing       : perl-MIME-Base64-3.15-396.el8.x86_64                 23/52
  Installing       : perl-IO-Socket-IP-0.39-5.el8.noarch                  24/52
  Installing       : perl-Data-Dumper-2.167-399.el8.x86_64                25/52
  Installing       : perl-File-Temp-0.230.600-1.el8.noarch                26/52
  Installing       : perl-Storable-1:3.11-3.el8.x86_64                    27/52
  Installing       : perl-Time-Local-1:1.280-1.el8.noarch                 28/52
  Installing       : perl-Digest-1.17-395.el8.noarch                      29/52
  Installing       : perl-Digest-MD5-2.55-396.el8.x86_64                  30/52
  Installing       : perl-Net-SSLeay-1.88-1.el8.x86_64                    31/52
  Installing       : perl-Math-Complex-1.59-416.el8.noarch                32/52
  Installing       : perl-Math-BigInt-1:1.9998.11-7.el8.noarch            33/52
  Installing       : perl-Pod-Escapes-1:1.07-395.el8.noarch               34/52
  Installing       : perl-Term-Cap-1.17-395.el8.noarch                    35/52
  Installing       : perl-Mozilla-CA-20160104-7.el8.noarch                36/52
  Installing       : perl-Encode-4:2.97-3.el8.x86_64                      37/52
  Installing       : perl-Pod-Simple-1:3.35-395.el8.noarch                38/52
  Installing       : perl-Getopt-Long-1:2.50-4.el8.noarch                 39/52
  Installing       : perl-podlators-4.11-1.el8.noarch                     40/52
  Installing       : perl-Pod-Usage-4:1.69-395.el8.noarch                 41/52
  Installing       : perl-Pod-Perldoc-3.28-396.el8.noarch                 42/52
  Installing       : perl-HTTP-Tiny-0.074-1.el8.noarch                    43/52
  Installing       : perl-IO-Socket-SSL-2.066-3.el8.noarch                44/52
  Installing       : perl-libnet-3.11-3.el8.noarch                        45/52
  Installing       : perl-URI-1.73-3.el8.noarch                           46/52
  Installing       : perl-DBI-1.641-3.module_el8.1.0+199+8f0a6bbd.x86_6   47/52
  Installing       : rsync-3.1.3-6.el8.x86_64                             48/52
  Installing       : lsof-4.91-2.el8.x86_64                               49/52
  Installing       : boost-program-options-1.66.0-6.el8.x86_64            50/52
  Running scriptlet: boost-program-options-1.66.0-6.el8.x86_64            50/52
  Running scriptlet: galera-4-26.4.4-1.rhel8.0.el8.x86_64                 51/52
  Installing       : galera-4-26.4.4-1.rhel8.0.el8.x86_64                 51/52
  Running scriptlet: galera-4-26.4.4-1.rhel8.0.el8.x86_64                 51/52
  Running scriptlet: MariaDB-server-10.5.3-1.el8.x86_64                   52/52
  Installing       : MariaDB-server-10.5.3-1.el8.x86_64                   52/52
  Running scriptlet: MariaDB-server-10.5.3-1.el8.x86_64                   52/52


Two all-privilege accounts were created.
One is root@localhost, it has no password, but you need to
be system 'root' user to connect. Use, for example, sudo mysql
The second is mysql@localhost, it has no password either, but
you need to be the system 'mysql' user to connect.
After connecting you can set the password, if you would need to be
able to connect as any of these users with a password and without sudo

See the MariaDB Knowledgebase at https://mariadb.com/kb or the
MySQL manual for more instructions.

Please report any problems at https://mariadb.org/jira

The latest information about MariaDB is available at https://mariadb.org/.
You can find additional information about the MySQL part at:
https://dev.mysql.com
Consider joining MariaDB's strong and vibrant community:
https://mariadb.org/get-involved/


  Verifying        : boost-program-options-1.66.0-6.el8.x86_64             1/52
  Verifying        : perl-DBI-1.641-3.module_el8.1.0+199+8f0a6bbd.x86_6    2/52
  Verifying        : perl-Digest-1.17-395.el8.noarch                       3/52
  Verifying        : perl-Digest-MD5-2.55-396.el8.x86_64                   4/52
  Verifying        : perl-IO-Socket-IP-0.39-5.el8.noarch                   5/52
  Verifying        : perl-IO-Socket-SSL-2.066-3.el8.noarch                 6/52
  Verifying        : perl-Mozilla-CA-20160104-7.el8.noarch                 7/52
  Verifying        : perl-Net-SSLeay-1.88-1.el8.x86_64                     8/52
  Verifying        : perl-URI-1.73-3.el8.noarch                            9/52
  Verifying        : perl-libnet-3.11-3.el8.noarch                        10/52
  Verifying        : lsof-4.91-2.el8.x86_64                               11/52
  Verifying        : perl-Carp-1.42-396.el8.noarch                        12/52
  Verifying        : perl-Data-Dumper-2.167-399.el8.x86_64                13/52
  Verifying        : perl-Encode-4:2.97-3.el8.x86_64                      14/52
  Verifying        : perl-Errno-1.28-416.el8.x86_64                       15/52
  Verifying        : perl-Exporter-5.72-396.el8.noarch                    16/52
  Verifying        : perl-File-Path-2.15-2.el8.noarch                     17/52
  Verifying        : perl-File-Temp-0.230.600-1.el8.noarch                18/52
  Verifying        : perl-Getopt-Long-1:2.50-4.el8.noarch                 19/52
  Verifying        : perl-HTTP-Tiny-0.074-1.el8.noarch                    20/52
  Verifying        : perl-IO-1.38-416.el8.x86_64                          21/52
  Verifying        : perl-MIME-Base64-3.15-396.el8.x86_64                 22/52
  Verifying        : perl-Math-BigInt-1:1.9998.11-7.el8.noarch            23/52
  Verifying        : perl-Math-Complex-1.59-416.el8.noarch                24/52
  Verifying        : perl-PathTools-3.74-1.el8.x86_64                     25/52
  Verifying        : perl-Pod-Escapes-1:1.07-395.el8.noarch               26/52
  Verifying        : perl-Pod-Perldoc-3.28-396.el8.noarch                 27/52
  Verifying        : perl-Pod-Simple-1:3.35-395.el8.noarch                28/52
  Verifying        : perl-Pod-Usage-4:1.69-395.el8.noarch                 29/52
  Verifying        : perl-Scalar-List-Utils-3:1.49-2.el8.x86_64           30/52
  Verifying        : perl-Socket-4:2.027-3.el8.x86_64                     31/52
  Verifying        : perl-Storable-1:3.11-3.el8.x86_64                    32/52
  Verifying        : perl-Term-ANSIColor-4.06-396.el8.noarch              33/52
  Verifying        : perl-Term-Cap-1.17-395.el8.noarch                    34/52
  Verifying        : perl-Text-ParseWords-3.30-395.el8.noarch             35/52
  Verifying        : perl-Text-Tabs+Wrap-2013.0523-395.el8.noarch         36/52
  Verifying        : perl-Time-Local-1:1.280-1.el8.noarch                 37/52
  Verifying        : perl-Unicode-Normalize-1.25-396.el8.x86_64           38/52
  Verifying        : perl-constant-1.33-396.el8.noarch                    39/52
  Verifying        : perl-interpreter-4:5.26.3-416.el8.x86_64             40/52
  Verifying        : perl-libs-4:5.26.3-416.el8.x86_64                    41/52
  Verifying        : perl-macros-4:5.26.3-416.el8.x86_64                  42/52
  Verifying        : perl-parent-1:0.237-1.el8.noarch                     43/52
  Verifying        : perl-podlators-4.11-1.el8.noarch                     44/52
  Verifying        : perl-threads-1:2.21-2.el8.x86_64                     45/52
  Verifying        : perl-threads-shared-1.58-2.el8.x86_64                46/52
  Verifying        : rsync-3.1.3-6.el8.x86_64                             47/52
  Verifying        : MariaDB-client-10.5.3-1.el8.x86_64                   48/52
  Verifying        : MariaDB-common-10.5.3-1.el8.x86_64                   49/52
  Verifying        : MariaDB-server-10.5.3-1.el8.x86_64                   50/52
  Verifying        : MariaDB-shared-10.5.3-1.el8.x86_64                   51/52
  Verifying        : galera-4-26.4.4-1.rhel8.0.el8.x86_64                 52/52

Installed:
  MariaDB-server-10.5.3-1.el8.x86_64
  perl-IO-Socket-IP-0.39-5.el8.noarch
  perl-IO-Socket-SSL-2.066-3.el8.noarch
  perl-Mozilla-CA-20160104-7.el8.noarch
  boost-program-options-1.66.0-6.el8.x86_64
  perl-DBI-1.641-3.module_el8.1.0+199+8f0a6bbd.x86_64
  perl-Digest-1.17-395.el8.noarch
  perl-Digest-MD5-2.55-396.el8.x86_64
  perl-Net-SSLeay-1.88-1.el8.x86_64
  perl-URI-1.73-3.el8.noarch
  perl-libnet-3.11-3.el8.noarch
  lsof-4.91-2.el8.x86_64
  perl-Carp-1.42-396.el8.noarch
  perl-Data-Dumper-2.167-399.el8.x86_64
  perl-Encode-4:2.97-3.el8.x86_64
  perl-Errno-1.28-416.el8.x86_64
  perl-Exporter-5.72-396.el8.noarch
  perl-File-Path-2.15-2.el8.noarch
  perl-File-Temp-0.230.600-1.el8.noarch
  perl-Getopt-Long-1:2.50-4.el8.noarch
  perl-HTTP-Tiny-0.074-1.el8.noarch
  perl-IO-1.38-416.el8.x86_64
  perl-MIME-Base64-3.15-396.el8.x86_64
  perl-Math-BigInt-1:1.9998.11-7.el8.noarch
  perl-Math-Complex-1.59-416.el8.noarch
  perl-PathTools-3.74-1.el8.x86_64
  perl-Pod-Escapes-1:1.07-395.el8.noarch
  perl-Pod-Perldoc-3.28-396.el8.noarch
  perl-Pod-Simple-1:3.35-395.el8.noarch
  perl-Pod-Usage-4:1.69-395.el8.noarch
  perl-Scalar-List-Utils-3:1.49-2.el8.x86_64
  perl-Socket-4:2.027-3.el8.x86_64
  perl-Storable-1:3.11-3.el8.x86_64
  perl-Term-ANSIColor-4.06-396.el8.noarch
  perl-Term-Cap-1.17-395.el8.noarch
  perl-Text-ParseWords-3.30-395.el8.noarch
  perl-Text-Tabs+Wrap-2013.0523-395.el8.noarch
  perl-Time-Local-1:1.280-1.el8.noarch
  perl-Unicode-Normalize-1.25-396.el8.x86_64
  perl-constant-1.33-396.el8.noarch
  perl-interpreter-4:5.26.3-416.el8.x86_64
  perl-libs-4:5.26.3-416.el8.x86_64
  perl-macros-4:5.26.3-416.el8.x86_64
  perl-parent-1:0.237-1.el8.noarch
  perl-podlators-4.11-1.el8.noarch
  perl-threads-1:2.21-2.el8.x86_64
  perl-threads-shared-1.58-2.el8.x86_64
  rsync-3.1.3-6.el8.x86_64
  MariaDB-client-10.5.3-1.el8.x86_64
  MariaDB-common-10.5.3-1.el8.x86_64
  MariaDB-shared-10.5.3-1.el8.x86_64
  galera-4-26.4.4-1.rhel8.0.el8.x86_64

Complete!

Enable and start MariaDB service.

[root@mariadb-01 ~]# systemctl enable --now mariadb.service
Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service â /usr/lib/systemd/system/mariadb.service.

Verify the status for MariaDB service.

[root@mariadb-01 ~]# systemctl status mariadb.service
â mariadb.service - MariaDB 10.5.3 database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor pre>
  Drop-In: /etc/systemd/system/mariadb.service.d
           ââmigrated-from-my.cnf-settings.conf
   Active: active (running) since Fri 2020-05-29 13:59:04 PKT; 12s ago
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
  Process: 12496 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_ST>
  Process: 12475 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && V>
  Process: 12473 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_STA>
 Main PID: 12485 (mysqld)
   Status: "Taking your SQL requests now..."
    Tasks: 11 (limit: 5916)
   Memory: 75.8M
   CGroup: /system.slice/mariadb.service
           ââ12485 /usr/sbin/mysqld

May 29 13:59:04 mariadb-01.centlinux.com mysqld[12485]: 2020-05-29 13:59:04 0 [>
May 29 13:59:04 mariadb-01.centlinux.com mysqld[12485]: 2020-05-29 13:59:04 0 [>
May 29 13:59:04 mariadb-01.centlinux.com mysqld[12485]: 2020-05-29 13:59:04 0 [>
May 29 13:59:04 mariadb-01.centlinux.com mysqld[12485]: 2020-05-29 13:59:04 0 [>
May 29 13:59:04 mariadb-01.centlinux.com mysqld[12485]: 2020-05-29 13:59:04 0 [>
May 29 13:59:04 mariadb-01.centlinux.com mysqld[12485]: 2020-05-29 13:59:04 0 [>

As mentioned in the installation output,

  • Linux root user can connect to MariaDB server as MariaDB root user without any password
  • Linux mysql user can connect to MariaDB server as MariaDB mysql user without any password

Also no other Linux user is allowed to login as MariaDB root or mysql users.

To allow the other Linux users to login as root or mysql user we need to set the password for these database users.

Connect with MariaDB server by using new mariadb command.

[root@mariadb-01 ~]# mariadb -u root
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 4
Server version: 10.5.3-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)]>

Set strong passwords for root and mysql users.

MariaDB [(none)]> alter user 'root'@'localhost' identified by 'Ahmer@1234';
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> alter user 'mysql'@'localhost' identified by 'Ahmer@1234';
Query OK, 0 rows affected (0.001 sec)

Reload the privileges tables.

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.001 sec)

List available databases in MariaDB server.

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.001 sec)

Exit from MariaDB Shell.

MariaDB [(none)]> exit
Bye

Our MariaDB Server 10.5 has been installed successfully.

 

Configure Database Security for MariaDB Server:

We can optionally remove the test databases and restrict the remote logins by root user.

For this purpose, we can use new mariadb-secure-installation command.

[root@mariadb-01 ~]# 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] n
 ... skipping.

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!

We have successfully installed and configured MariaDB Server 10.5 on CentOS 8.

No comments:

Post a Comment