Skip to main content

安裝 MariaDB 10.3 版

1 安裝 MariaDB 10.3 套件

在 Rocky Linux 8 安裝 MariaDB 10.3 相對簡單,而且 10.3 是比較穩定的版本,故目前仍建議使用預設的版本,安裝指令如下所示,這個版本的 MariaDB 相依了非常多的套件。

$ sudo yum install mariadb mariadb-server -y
[sudo] kevin 的密碼:
上次中介資料過期檢查:1:23:23 前,時間點為西元2022年05月31日 (週二) 15時17分06秒。
依賴關係解析完畢。
==============================================================================================================================================================================================================
 軟體包                                                 架構                               版本                                                                   軟體庫                                 大小
==============================================================================================================================================================================================================
安裝:
 mariadb                                                x86_64                             3:10.3.32-2.module+el8.5.0+777+18007c86                                appstream                             6.0 M
 mariadb-server                                         x86_64                             3:10.3.32-2.module+el8.5.0+777+18007c86                                appstream                              16 M
將安裝依賴項目:
 mariadb-common                                         x86_64                             3:10.3.32-2.module+el8.5.0+777+18007c86                                appstream                              63 k
 mariadb-connector-c                                    x86_64                             3.1.11-2.el8_3                                                         appstream                             199 k
 mariadb-connector-c-config                             noarch                             3.1.11-2.el8_3                                                         appstream                              14 k
 mariadb-errmsg                                         x86_64                             3:10.3.32-2.module+el8.5.0+777+18007c86                                appstream                             233 k
 perl-Carp                                              noarch                             1.42-396.el8                                                           baseos                                 29 k
 perl-DBD-MySQL                                         x86_64                             4.046-3.module+el8.6.0+904+ef468285                                    appstream                             155 k
 perl-DBI                                               x86_64                             1.641-4.module+el8.6.0+891+677074cb                                    appstream                             739 k
 perl-Data-Dumper                                       x86_64                             2.167-399.el8                                                          baseos                                 57 k
 perl-Digest                                            noarch                             1.17-395.el8                                                           appstream                              26 k
 perl-Digest-MD5                                        x86_64                             2.55-396.el8                                                           appstream                              36 k
 perl-Encode                                            x86_64                             4:2.97-3.el8                                                           baseos                                1.5 M
 perl-Errno                                             x86_64                             1.28-421.el8                                                           baseos                                 75 k
 perl-Exporter                                          noarch                             5.72-396.el8                                                           baseos                                 33 k
 perl-File-Path                                         noarch                             2.15-2.el8                                                             baseos                                 37 k
 perl-File-Temp                                         noarch                             0.230.600-1.el8                                                        baseos                                 62 k
 perl-Getopt-Long                                       noarch                             1:2.50-4.el8                                                           baseos                                 62 k
 perl-HTTP-Tiny                                         noarch                             0.074-1.el8                                                            baseos                                 57 k
 perl-IO                                                x86_64                             1.38-421.el8                                                           baseos                                141 k
 perl-MIME-Base64                                       x86_64                             3.15-396.el8                                                           baseos                                 30 k
 perl-Math-BigInt                                       noarch                             1:1.9998.11-7.el8                                                      baseos                                194 k
 perl-Math-Complex                                      noarch                             1.59-421.el8                                                           baseos                                108 k
 perl-Net-SSLeay                                        x86_64                             1.88-2.module+el8.6.0+957+15d660ad                                     appstream                             378 k
 perl-PathTools                                         x86_64                             3.74-1.el8                                                             baseos                                 89 k
 perl-Pod-Escapes                                       noarch                             1:1.07-395.el8                                                         baseos                                 19 k
 perl-Pod-Perldoc                                       noarch                             3.28-396.el8                                                           baseos                                 85 k
 perl-Pod-Simple                                        noarch                             1:3.35-395.el8                                                         baseos                                212 k
 perl-Pod-Usage                                         noarch                             4:1.69-395.el8                                                         baseos                                 33 k
 perl-Scalar-List-Utils                                 x86_64                             3:1.49-2.el8                                                           baseos                                 67 k
 perl-Socket                                            x86_64                             4:2.027-3.el8                                                          baseos                                 58 k
 perl-Storable                                          x86_64                             1:3.11-3.el8                                                           baseos                                 97 k
 perl-Term-ANSIColor                                    noarch                             4.06-396.el8                                                           baseos                                 45 k
 perl-Term-Cap                                          noarch                             1.17-395.el8                                                           baseos                                 22 k
 perl-Text-ParseWords                                   noarch                             3.30-395.el8                                                           baseos                                 17 k
 perl-Text-Tabs+Wrap                                    noarch                             2013.0523-395.el8                                                      baseos                                 23 k
 perl-Time-Local                                        noarch                             1:1.280-1.el8                                                          baseos                                 32 k
 perl-URI                                               noarch                             1.73-3.el8                                                             appstream                             115 k
 perl-Unicode-Normalize                                 x86_64                             1.25-396.el8                                                           baseos                                 81 k
 perl-constant                                          noarch                             1.33-396.el8                                                           baseos                                 24 k
 perl-interpreter                                       x86_64                             4:5.26.3-421.el8                                                       baseos                                6.3 M
 perl-libnet                                            noarch                             3.11-3.el8                                                             appstream                             120 k
 perl-libs                                              x86_64                             4:5.26.3-421.el8                                                       baseos                                1.6 M
 perl-macros                                            x86_64                             4:5.26.3-421.el8                                                       baseos                                 71 k
 perl-parent                                            noarch                             1:0.237-1.el8                                                          baseos                                 19 k
 perl-podlators                                         noarch                             4.11-1.el8                                                             baseos                                117 k
 perl-threads                                           x86_64                             1:2.21-2.el8                                                           baseos                                 60 k
 perl-threads-shared                                    x86_64                             1.58-2.el8                                                             baseos                                 47 k
將安裝弱依賴項目:
 mariadb-backup                                         x86_64                             3:10.3.32-2.module+el8.5.0+777+18007c86                                appstream                             6.1 M
 mariadb-gssapi-server                                  x86_64                             3:10.3.32-2.module+el8.5.0+777+18007c86                                appstream                              50 k
 mariadb-server-utils                                   x86_64                             3:10.3.32-2.module+el8.5.0+777+18007c86                                appstream                             1.1 M
 perl-IO-Socket-IP                                      noarch                             0.39-5.el8                                                             appstream                              46 k
 perl-IO-Socket-SSL                                     noarch                             2.066-4.module+el8.6.0+957+15d660ad                                    appstream                             297 k
 perl-Mozilla-CA                                        noarch                             20160104-7.module+el8.6.0+965+850557f9                                 appstream                              14 k
正在啟用模組串流:
 mariadb                                                                                   10.3
 perl                                                                                      5.26
 perl-DBD-MySQL                                                                            4.046
 perl-DBI                                                                                  1.641
 perl-IO-Socket-SSL                                                                        2.066
 perl-libwww-perl                                                                          6.34

處理事項摘要
==============================================================================================================================================================================================================
安裝  54 軟體包

總下載大小:43 M
安裝的大小:191 M
下載軟體包:
(1/54): mariadb-common-10.3.32-2.module+el8.5.0+777+18007c86.x86_64.rpm                                                                                                       157 kB/s |  63 kB     00:00
(2/54): mariadb-connector-c-3.1.11-2.el8_3.x86_64.rpm                                                                                                                         579 kB/s | 199 kB     00:00
(3/54): mariadb-connector-c-config-3.1.11-2.el8_3.noarch.rpm                                                                                                                  115 kB/s |  14 kB     00:00
(4/54): mariadb-errmsg-10.3.32-2.module+el8.5.0+777+18007c86.x86_64.rpm                                                                                                       775 kB/s | 233 kB     00:00
(5/54): mariadb-gssapi-server-10.3.32-2.module+el8.5.0+777+18007c86.x86_64.rpm                                                                                                483 kB/s |  50 kB     00:00
(6/54): mariadb-backup-10.3.32-2.module+el8.5.0+777+18007c86.x86_64.rpm                                                                                                       3.1 MB/s | 6.1 MB     00:01
(7/54): mariadb-server-utils-10.3.32-2.module+el8.5.0+777+18007c86.x86_64.rpm                                                                                                 1.4 MB/s | 1.1 MB     00:00
(8/54): perl-DBD-MySQL-4.046-3.module+el8.6.0+904+ef468285.x86_64.rpm                                                                                                         491 kB/s | 155 kB     00:00
(9/54): mariadb-10.3.32-2.module+el8.5.0+777+18007c86.x86_64.rpm                                                                                                              1.7 MB/s | 6.0 MB     00:03
(10/54): perl-Digest-1.17-395.el8.noarch.rpm                                                                                                                                  246 kB/s |  26 kB     00:00
(11/54): perl-Digest-MD5-2.55-396.el8.x86_64.rpm                                                                                                                              368 kB/s |  36 kB     00:00
(12/54): perl-DBI-1.641-4.module+el8.6.0+891+677074cb.x86_64.rpm                                                                                                              1.0 MB/s | 739 kB     00:00
(13/54): perl-IO-Socket-IP-0.39-5.el8.noarch.rpm                                                                                                                              337 kB/s |  46 kB     00:00
(14/54): perl-Mozilla-CA-20160104-7.module+el8.6.0+965+850557f9.noarch.rpm                                                                                                    144 kB/s |  14 kB     00:00
(15/54): perl-IO-Socket-SSL-2.066-4.module+el8.6.0+957+15d660ad.noarch.rpm                                                                                                    988 kB/s | 297 kB     00:00
(16/54): perl-URI-1.73-3.el8.noarch.rpm                                                                                                                                       973 kB/s | 115 kB     00:00
(17/54): perl-Net-SSLeay-1.88-2.module+el8.6.0+957+15d660ad.x86_64.rpm                                                                                                        1.2 MB/s | 378 kB     00:00
(18/54): perl-libnet-3.11-3.el8.noarch.rpm                                                                                                                                    1.0 MB/s | 120 kB     00:00
(19/54): perl-Carp-1.42-396.el8.noarch.rpm                                                                                                                                    138 kB/s |  29 kB     00:00
(20/54): perl-Data-Dumper-2.167-399.el8.x86_64.rpm                                                                                                                            255 kB/s |  57 kB     00:00
(21/54): perl-Errno-1.28-421.el8.x86_64.rpm                                                                                                                                   683 kB/s |  75 kB     00:00
(22/54): perl-Exporter-5.72-396.el8.noarch.rpm                                                                                                                                688 kB/s |  33 kB     00:00
(23/54): perl-File-Path-2.15-2.el8.noarch.rpm                                                                                                                                 418 kB/s |  37 kB     00:00
(24/54): perl-Encode-2.97-3.el8.x86_64.rpm                                                                                                                                    3.4 MB/s | 1.5 MB     00:00
(25/54): perl-File-Temp-0.230.600-1.el8.noarch.rpm                                                                                                                            767 kB/s |  62 kB     00:00
(26/54): perl-Getopt-Long-2.50-4.el8.noarch.rpm                                                                                                                               1.5 MB/s |  62 kB     00:00
(27/54): perl-HTTP-Tiny-0.074-1.el8.noarch.rpm                                                                                                                                1.3 MB/s |  57 kB     00:00
(28/54): perl-IO-1.38-421.el8.x86_64.rpm                                                                                                                                      2.5 MB/s | 141 kB     00:00
(29/54): perl-Math-BigInt-1.9998.11-7.el8.noarch.rpm                                                                                                                          2.2 MB/s | 194 kB     00:00
(30/54): perl-Math-Complex-1.59-421.el8.noarch.rpm                                                                                                                            1.4 MB/s | 108 kB     00:00
(31/54): perl-MIME-Base64-3.15-396.el8.x86_64.rpm                                                                                                                             140 kB/s |  30 kB     00:00
(32/54): perl-PathTools-3.74-1.el8.x86_64.rpm                                                                                                                                 1.7 MB/s |  89 kB     00:00
(33/54): perl-Pod-Escapes-1.07-395.el8.noarch.rpm                                                                                                                             383 kB/s |  19 kB     00:00
(34/54): perl-Pod-Perldoc-3.28-396.el8.noarch.rpm                                                                                                                             1.6 MB/s |  85 kB     00:00
(35/54): perl-Pod-Usage-1.69-395.el8.noarch.rpm                                                                                                                               582 kB/s |  33 kB     00:00
(36/54): perl-Pod-Simple-3.35-395.el8.noarch.rpm                                                                                                                              1.2 MB/s | 212 kB     00:00
(37/54): perl-Socket-2.027-3.el8.x86_64.rpm                                                                                                                                   1.2 MB/s |  58 kB     00:00
(38/54): perl-Storable-3.11-3.el8.x86_64.rpm                                                                                                                                  1.1 MB/s |  97 kB     00:00
(39/54): perl-Scalar-List-Utils-1.49-2.el8.x86_64.rpm                                                                                                                         295 kB/s |  67 kB     00:00
(40/54): perl-Term-ANSIColor-4.06-396.el8.noarch.rpm                                                                                                                          1.0 MB/s |  45 kB     00:00
(41/54): perl-Term-Cap-1.17-395.el8.noarch.rpm                                                                                                                                550 kB/s |  22 kB     00:00
(42/54): perl-Text-ParseWords-3.30-395.el8.noarch.rpm                                                                                                                         278 kB/s |  17 kB     00:00
(43/54): perl-Text-Tabs+Wrap-2013.0523-395.el8.noarch.rpm                                                                                                                     452 kB/s |  23 kB     00:00
(44/54): perl-Time-Local-1.280-1.el8.noarch.rpm                                                                                                                               754 kB/s |  32 kB     00:00
(45/54): perl-Unicode-Normalize-1.25-396.el8.x86_64.rpm                                                                                                                       1.5 MB/s |  81 kB     00:00
(46/54): perl-constant-1.33-396.el8.noarch.rpm                                                                                                                                591 kB/s |  24 kB     00:00
(47/54): perl-libs-5.26.3-421.el8.x86_64.rpm                                                                                                                                  2.6 MB/s | 1.6 MB     00:00
(48/54): perl-macros-5.26.3-421.el8.x86_64.rpm                                                                                                                                968 kB/s |  71 kB     00:00
(49/54): perl-parent-0.237-1.el8.noarch.rpm                                                                                                                                   423 kB/s |  19 kB     00:00
(50/54): perl-podlators-4.11-1.el8.noarch.rpm                                                                                                                                 2.0 MB/s | 117 kB     00:00
(51/54): perl-threads-2.21-2.el8.x86_64.rpm                                                                                                                                   1.4 MB/s |  60 kB     00:00
(52/54): perl-threads-shared-1.58-2.el8.x86_64.rpm                                                                                                                            1.0 MB/s |  47 kB     00:00
(53/54): perl-interpreter-5.26.3-421.el8.x86_64.rpm                                                                                                                           4.2 MB/s | 6.3 MB     00:01
(54/54): mariadb-server-10.3.32-2.module+el8.5.0+777+18007c86.x86_64.rpm                                                                                                      1.5 MB/s |  16 MB     00:11
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
總計                                                                                                                                                                          3.2 MB/s |  43 MB     00:13
執行處理事項檢查
處理事項檢查成功。
執行處理事項測試
處理事項測試成功。
執行處理事項
  準備        :                                                                                                                                                                                           1/1
  正在安裝    : mariadb-connector-c-config-3.1.11-2.el8_3.noarch                                                                                                                                         1/54
  正在安裝    : mariadb-common-3:10.3.32-2.module+el8.5.0+777+18007c86.x86_64                                                                                                                            2/54
  正在安裝    : mariadb-errmsg-3:10.3.32-2.module+el8.5.0+777+18007c86.x86_64                                                                                                                            3/54
  正在安裝    : perl-Digest-1.17-395.el8.noarch                                                                                                                                                          4/54
  正在安裝    : perl-Digest-MD5-2.55-396.el8.x86_64                                                                                                                                                      5/54
  正在安裝    : perl-Data-Dumper-2.167-399.el8.x86_64                                                                                                                                                    6/54
  正在安裝    : perl-libnet-3.11-3.el8.noarch                                                                                                                                                            7/54
  正在安裝    : perl-Net-SSLeay-1.88-2.module+el8.6.0+957+15d660ad.x86_64                                                                                                                                8/54
  正在安裝    : perl-URI-1.73-3.el8.noarch                                                                                                                                                               9/54
  正在安裝    : perl-Pod-Escapes-1:1.07-395.el8.noarch                                                                                                                                                  10/54
  正在安裝    : perl-Mozilla-CA-20160104-7.module+el8.6.0+965+850557f9.noarch                                                                                                                           11/54
  正在安裝    : perl-IO-Socket-IP-0.39-5.el8.noarch                                                                                                                                                     12/54
  正在安裝    : perl-Time-Local-1:1.280-1.el8.noarch                                                                                                                                                    13/54
  正在安裝    : perl-IO-Socket-SSL-2.066-4.module+el8.6.0+957+15d660ad.noarch                                                                                                                           14/54
  正在安裝    : perl-Term-ANSIColor-4.06-396.el8.noarch                                                                                                                                                 15/54
  正在安裝    : perl-Term-Cap-1.17-395.el8.noarch                                                                                                                                                       16/54
  正在安裝    : perl-File-Temp-0.230.600-1.el8.noarch                                                                                                                                                   17/54
  正在安裝    : perl-Pod-Simple-1:3.35-395.el8.noarch                                                                                                                                                   18/54
  正在安裝    : perl-HTTP-Tiny-0.074-1.el8.noarch                                                                                                                                                       19/54
  正在安裝    : perl-podlators-4.11-1.el8.noarch                                                                                                                                                        20/54
  正在安裝    : perl-Pod-Perldoc-3.28-396.el8.noarch                                                                                                                                                    21/54
  正在安裝    : perl-Text-ParseWords-3.30-395.el8.noarch                                                                                                                                                22/54
  正在安裝    : perl-Pod-Usage-4:1.69-395.el8.noarch                                                                                                                                                    23/54
  正在安裝    : perl-MIME-Base64-3.15-396.el8.x86_64                                                                                                                                                    24/54
  正在安裝    : perl-Storable-1:3.11-3.el8.x86_64                                                                                                                                                       25/54
  正在安裝    : perl-Getopt-Long-1:2.50-4.el8.noarch                                                                                                                                                    26/54
  正在安裝    : perl-Errno-1.28-421.el8.x86_64                                                                                                                                                          27/54
  正在安裝    : perl-Socket-4:2.027-3.el8.x86_64                                                                                                                                                        28/54
  正在安裝    : perl-Encode-4:2.97-3.el8.x86_64                                                                                                                                                         29/54
  正在安裝    : perl-Carp-1.42-396.el8.noarch                                                                                                                                                           30/54
  正在安裝    : perl-Exporter-5.72-396.el8.noarch                                                                                                                                                       31/54
  正在安裝    : perl-libs-4:5.26.3-421.el8.x86_64                                                                                                                                                       32/54
  正在安裝    : perl-Scalar-List-Utils-3:1.49-2.el8.x86_64                                                                                                                                              33/54
  正在安裝    : perl-parent-1:0.237-1.el8.noarch                                                                                                                                                        34/54
  正在安裝    : perl-macros-4:5.26.3-421.el8.x86_64                                                                                                                                                     35/54
  正在安裝    : perl-Text-Tabs+Wrap-2013.0523-395.el8.noarch                                                                                                                                            36/54
  正在安裝    : perl-Unicode-Normalize-1.25-396.el8.x86_64                                                                                                                                              37/54
  正在安裝    : perl-File-Path-2.15-2.el8.noarch                                                                                                                                                        38/54
  正在安裝    : perl-IO-1.38-421.el8.x86_64                                                                                                                                                             39/54
  正在安裝    : perl-PathTools-3.74-1.el8.x86_64                                                                                                                                                        40/54
  正在安裝    : perl-constant-1.33-396.el8.noarch                                                                                                                                                       41/54
  正在安裝    : perl-threads-1:2.21-2.el8.x86_64                                                                                                                                                        42/54
  正在安裝    : perl-threads-shared-1.58-2.el8.x86_64                                                                                                                                                   43/54
  正在安裝    : perl-interpreter-4:5.26.3-421.el8.x86_64                                                                                                                                                44/54
  正在安裝    : perl-Math-Complex-1.59-421.el8.noarch                                                                                                                                                   45/54
  正在安裝    : perl-Math-BigInt-1:1.9998.11-7.el8.noarch                                                                                                                                               46/54
  正在安裝    : perl-DBI-1.641-4.module+el8.6.0+891+677074cb.x86_64                                                                                                                                     47/54
  正在安裝    : perl-DBD-MySQL-4.046-3.module+el8.6.0+904+ef468285.x86_64                                                                                                                               48/54
  正在安裝    : mariadb-connector-c-3.1.11-2.el8_3.x86_64                                                                                                                                               49/54
  正在安裝    : mariadb-backup-3:10.3.32-2.module+el8.5.0+777+18007c86.x86_64                                                                                                                           50/54
  正在安裝    : mariadb-gssapi-server-3:10.3.32-2.module+el8.5.0+777+18007c86.x86_64                                                                                                                    51/54
  正在安裝    : mariadb-server-utils-3:10.3.32-2.module+el8.5.0+777+18007c86.x86_64                                                                                                                     52/54
  執行小令稿  : mariadb-server-3:10.3.32-2.module+el8.5.0+777+18007c86.x86_64                                                                                                                           53/54
  正在安裝    : mariadb-server-3:10.3.32-2.module+el8.5.0+777+18007c86.x86_64                                                                                                                           53/54
  執行小令稿  : mariadb-server-3:10.3.32-2.module+el8.5.0+777+18007c86.x86_64                                                                                                                           53/54
  正在安裝    : mariadb-3:10.3.32-2.module+el8.5.0+777+18007c86.x86_64                                                                                                                                  54/54
  執行小令稿  : mariadb-3:10.3.32-2.module+el8.5.0+777+18007c86.x86_64                                                                                                                                  54/54
  核驗        : mariadb-3:10.3.32-2.module+el8.5.0+777+18007c86.x86_64                                                                                                                                   1/54
  核驗        : mariadb-backup-3:10.3.32-2.module+el8.5.0+777+18007c86.x86_64                                                                                                                            2/54
  核驗        : mariadb-common-3:10.3.32-2.module+el8.5.0+777+18007c86.x86_64                                                                                                                            3/54
  核驗        : mariadb-connector-c-3.1.11-2.el8_3.x86_64                                                                                                                                                4/54
  核驗        : mariadb-connector-c-config-3.1.11-2.el8_3.noarch                                                                                                                                         5/54
  核驗        : mariadb-errmsg-3:10.3.32-2.module+el8.5.0+777+18007c86.x86_64                                                                                                                            6/54
  核驗        : mariadb-gssapi-server-3:10.3.32-2.module+el8.5.0+777+18007c86.x86_64                                                                                                                     7/54
  核驗        : mariadb-server-3:10.3.32-2.module+el8.5.0+777+18007c86.x86_64                                                                                                                            8/54
  核驗        : mariadb-server-utils-3:10.3.32-2.module+el8.5.0+777+18007c86.x86_64                                                                                                                      9/54
  核驗        : perl-DBD-MySQL-4.046-3.module+el8.6.0+904+ef468285.x86_64                                                                                                                               10/54
  核驗        : perl-DBI-1.641-4.module+el8.6.0+891+677074cb.x86_64                                                                                                                                     11/54
  核驗        : perl-Digest-1.17-395.el8.noarch                                                                                                                                                         12/54
  核驗        : perl-Digest-MD5-2.55-396.el8.x86_64                                                                                                                                                     13/54
  核驗        : perl-IO-Socket-IP-0.39-5.el8.noarch                                                                                                                                                     14/54
  核驗        : perl-IO-Socket-SSL-2.066-4.module+el8.6.0+957+15d660ad.noarch                                                                                                                           15/54
  核驗        : perl-Mozilla-CA-20160104-7.module+el8.6.0+965+850557f9.noarch                                                                                                                           16/54
  核驗        : perl-Net-SSLeay-1.88-2.module+el8.6.0+957+15d660ad.x86_64                                                                                                                               17/54
  核驗        : perl-URI-1.73-3.el8.noarch                                                                                                                                                              18/54
  核驗        : perl-libnet-3.11-3.el8.noarch                                                                                                                                                           19/54
  核驗        : perl-Carp-1.42-396.el8.noarch                                                                                                                                                           20/54
  核驗        : perl-Data-Dumper-2.167-399.el8.x86_64                                                                                                                                                   21/54
  核驗        : perl-Encode-4:2.97-3.el8.x86_64                                                                                                                                                         22/54
  核驗        : perl-Errno-1.28-421.el8.x86_64                                                                                                                                                          23/54
  核驗        : perl-Exporter-5.72-396.el8.noarch                                                                                                                                                       24/54
  核驗        : perl-File-Path-2.15-2.el8.noarch                                                                                                                                                        25/54
  核驗        : perl-File-Temp-0.230.600-1.el8.noarch                                                                                                                                                   26/54
  核驗        : perl-Getopt-Long-1:2.50-4.el8.noarch                                                                                                                                                    27/54
  核驗        : perl-HTTP-Tiny-0.074-1.el8.noarch                                                                                                                                                       28/54
  核驗        : perl-IO-1.38-421.el8.x86_64                                                                                                                                                             29/54
  核驗        : perl-MIME-Base64-3.15-396.el8.x86_64                                                                                                                                                    30/54
  核驗        : perl-Math-BigInt-1:1.9998.11-7.el8.noarch                                                                                                                                               31/54
  核驗        : perl-Math-Complex-1.59-421.el8.noarch                                                                                                                                                   32/54
  核驗        : perl-PathTools-3.74-1.el8.x86_64                                                                                                                                                        33/54
  核驗        : perl-Pod-Escapes-1:1.07-395.el8.noarch                                                                                                                                                  34/54
  核驗        : perl-Pod-Perldoc-3.28-396.el8.noarch                                                                                                                                                    35/54
  核驗        : perl-Pod-Simple-1:3.35-395.el8.noarch                                                                                                                                                   36/54
  核驗        : perl-Pod-Usage-4:1.69-395.el8.noarch                                                                                                                                                    37/54
  核驗        : perl-Scalar-List-Utils-3:1.49-2.el8.x86_64                                                                                                                                              38/54
  核驗        : perl-Socket-4:2.027-3.el8.x86_64                                                                                                                                                        39/54
  核驗        : perl-Storable-1:3.11-3.el8.x86_64                                                                                                                                                       40/54
  核驗        : perl-Term-ANSIColor-4.06-396.el8.noarch                                                                                                                                                 41/54
  核驗        : perl-Term-Cap-1.17-395.el8.noarch                                                                                                                                                       42/54
  核驗        : perl-Text-ParseWords-3.30-395.el8.noarch                                                                                                                                                43/54
  核驗        : perl-Text-Tabs+Wrap-2013.0523-395.el8.noarch                                                                                                                                            44/54
  核驗        : perl-Time-Local-1:1.280-1.el8.noarch                                                                                                                                                    45/54
  核驗        : perl-Unicode-Normalize-1.25-396.el8.x86_64                                                                                                                                              46/54
  核驗        : perl-constant-1.33-396.el8.noarch                                                                                                                                                       47/54
  核驗        : perl-interpreter-4:5.26.3-421.el8.x86_64                                                                                                                                                48/54
  核驗        : perl-libs-4:5.26.3-421.el8.x86_64                                                                                                                                                       49/54
  核驗        : perl-macros-4:5.26.3-421.el8.x86_64                                                                                                                                                     50/54
  核驗        : perl-parent-1:0.237-1.el8.noarch                                                                                                                                                        51/54
  核驗        : perl-podlators-4.11-1.el8.noarch                                                                                                                                                        52/54
  核驗        : perl-threads-1:2.21-2.el8.x86_64                                                                                                                                                        53/54
  核驗        : perl-threads-shared-1.58-2.el8.x86_64                                                                                                                                                   54/54

已安裝:
  mariadb-3:10.3.32-2.module+el8.5.0+777+18007c86.x86_64                 mariadb-backup-3:10.3.32-2.module+el8.5.0+777+18007c86.x86_64   mariadb-common-3:10.3.32-2.module+el8.5.0+777+18007c86.x86_64
  mariadb-connector-c-3.1.11-2.el8_3.x86_64                              mariadb-connector-c-config-3.1.11-2.el8_3.noarch                mariadb-errmsg-3:10.3.32-2.module+el8.5.0+777+18007c86.x86_64
  mariadb-gssapi-server-3:10.3.32-2.module+el8.5.0+777+18007c86.x86_64   mariadb-server-3:10.3.32-2.module+el8.5.0+777+18007c86.x86_64   mariadb-server-utils-3:10.3.32-2.module+el8.5.0+777+18007c86.x86_64
  perl-Carp-1.42-396.el8.noarch                                          perl-DBD-MySQL-4.046-3.module+el8.6.0+904+ef468285.x86_64       perl-DBI-1.641-4.module+el8.6.0+891+677074cb.x86_64
  perl-Data-Dumper-2.167-399.el8.x86_64                                  perl-Digest-1.17-395.el8.noarch                                 perl-Digest-MD5-2.55-396.el8.x86_64
  perl-Encode-4:2.97-3.el8.x86_64                                        perl-Errno-1.28-421.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-421.el8.x86_64                                     perl-IO-Socket-IP-0.39-5.el8.noarch
  perl-IO-Socket-SSL-2.066-4.module+el8.6.0+957+15d660ad.noarch          perl-MIME-Base64-3.15-396.el8.x86_64                            perl-Math-BigInt-1:1.9998.11-7.el8.noarch
  perl-Math-Complex-1.59-421.el8.noarch                                  perl-Mozilla-CA-20160104-7.module+el8.6.0+965+850557f9.noarch   perl-Net-SSLeay-1.88-2.module+el8.6.0+957+15d660ad.x86_64
  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-URI-1.73-3.el8.noarch                                      perl-Unicode-Normalize-1.25-396.el8.x86_64
  perl-constant-1.33-396.el8.noarch                                      perl-interpreter-4:5.26.3-421.el8.x86_64                        perl-libnet-3.11-3.el8.noarch
  perl-libs-4:5.26.3-421.el8.x86_64                                      perl-macros-4:5.26.3-421.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

完成!
2 啟用 MariaDB 伺服器的服務

啟用服務的指令如下:

$ sudo systemctl restart mariadb
$ sudo systemctl enable mariadb
Created symlink /etc/systemd/system/mysql.service → /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/mysqld.service → /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service → /usr/lib/systemd/system/mariadb.service.
3 初始化 MariaDB 資料庫環境

初始化指令如下:

$ sudo mysql_secure_installation

接下來會一直問各種問題,如下所示,詢問目前 root 用戶的密碼,因為一開始沒有設定,請直接按 Enter 鍵繼續。

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
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):直接按 Enter 鍵

要不要設定 root 密碼?按下 Y 並輸入二次密碼。

OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!

是否要移除 anonymous users 的密碼?按下 Y 繼續。

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!

是否要關閉 root 從遠端登入的權限?按下 Y 繼續。

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!

是否要 Reload 權限?按下 Y 繼續。

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!

是否要移除測試資料庫?按下 Y 繼續。

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!

完成 MariaDB 初始化設定工作。

4 設定 MariaDB 的預設字元集(UTF8mb4)

請在 /etc/my.conf.d/ 目錄中新增一個新的設定檔,指令如下:

sudo vim /etc/my.cnf.d/default-character.cnf

內容如下:

[client]
default-character-set=utf8mb4            ## 修改 Client characterset 與 Conn. characterset
[mysqld]
character-set-server=utf8mb4             ## 修改 Server characterset 與 Db characterset
collation-server=utf8mb4_unicode_ci  ## 會修改預設的校驗比對方法

5 重新啟動 MariaDB 服務
$ sudo systemctl restart mariadb
6 確認 MariaDB 服務狀態

利用 netstat 指令確認服務是否有啟動(有發現 3306 port 運作中)。

$ sudo netstat -tlnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      644/sshd
tcp6       0      0 :::3306                 :::*                    LISTEN      9388/mysqld
tcp6       0      0 :::80                   :::*                    LISTEN      5756/httpd
tcp6       0      0 :::22                   :::*                    LISTEN      644/sshd
tcp6       0      0 :::443                  :::*                    LISTEN      5756/httpd

利用 systemctl 指令查看一下相關服務的啟用情況。

$ sudo systemctl status mariadb
● mariadb.service - MariaDB 10.3 database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2022-05-31 17:01:18 CST; 2min 0s ago
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
  Process: 9419 ExecStartPost=/usr/libexec/mysql-check-upgrade (code=exited, status=0/SUCCESS)
  Process: 9349 ExecStartPre=/usr/libexec/mysql-prepare-db-dir mariadb.service (code=exited, status=0/SUCCESS)
  Process: 9324 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS)
 Main PID: 9388 (mysqld)
   Status: "Taking your SQL requests now..."
    Tasks: 30 (limit: 11374)
   Memory: 73.4M
   CGroup: /system.slice/mariadb.service
           └─9388 /usr/libexec/mysqld --basedir=/usr

 5月 31 17:01:18 rockylinux.ossii.com.tw systemd[1]: mariadb.service: Succeeded.
 5月 31 17:01:18 rockylinux.ossii.com.tw systemd[1]: Stopped MariaDB 10.3 database server.
 5月 31 17:01:18 rockylinux.ossii.com.tw systemd[1]: Starting MariaDB 10.3 database server...
 5月 31 17:01:18 rockylinux.ossii.com.tw mysql-prepare-db-dir[9349]: Database MariaDB is probably initialized in /var/lib/mysql already, nothing is done.
 5月 31 17:01:18 rockylinux.ossii.com.tw mysql-prepare-db-dir[9349]: If this is not the case, make sure the /var/lib/mysql is empty before running mysql-prepare-db-dir.
 5月 31 17:01:18 rockylinux.ossii.com.tw mysqld[9388]: 2022-05-31 17:01:18 0 [Note] /usr/libexec/mysqld (mysqld 10.3.32-MariaDB) starting as process 9388 ...
 5月 31 17:01:18 rockylinux.ossii.com.tw systemd[1]: Started MariaDB 10.3 database server.