CentOS 8에서 MariaDB 10.4 버전의 설치 방법을 알아보고, 실습을 통해 쉽게 적용하고 사용할 수 있습니다.
MariaDB 다운로드 웹 페이지 |
CentOS 8에서 MariaDB 10.4 버전의 설치 방법을 알아보고, 실습을 통해 쉽게 적용하고 사용할 수 있습니다.
실습 환경
- 운영 체제(OS) : CentOS 8
- root 계정으로 실행
- IP 설정 및 인터넷이 가능한 환경
참고 사항
- DNF 와 YUM 명령어 둘다 사용 가능합니다.
- 이 글에서는 DNF 명령어를 사용합니다.
MariaDB 저장소 등록하기
cat 명령을 사용해서 Mariadb.repo 파일을 생성합니다.
[cat << EOF >/etc/yum.repos.d/MariaDB.repo #MariaDB 10.4 CentOS repository list #http://downloads.mariadb.org/mariadb/repositories/ [mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.4/centos8-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1 EOF]
MariaDB 저장소 파일 내용 확인하기
Mariadb.repo 파일 내용을 확인합니다.
[cat /etc/yum.repos.d/MariaDB.repo]
[root@RunIT ~]# cat /etc/yum.repos.d/MariaDB.repo #MariaDB 10.4 CentOS repository list #http://downloads.mariadb.org/mariadb/repositories/ [mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.4/centos8-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1
Boost-program-options 설치하기
- MariaDB-server 설치 시 galera-4 패키지가 먼저 설치되어야 합니다.
- galera-4 설치 시 libboost_program_options.so 라이브러리가 필요합니다.
- 종속성 해결을 위해 Boost-program-options 패키지를 먼저 설치합니다.
[dnf install boost-program-options -y]
[root@RunIT ~]# dnf install boost-program-options -y CentOS-8 - AppStream 125 kB/s | 6.5 MB 00:53 CentOS-8 - Base 125 kB/s | 5.0 MB 00:40 CentOS-8 - Extras 2.4 kB/s | 2.1 kB 00:00 Last metadata expiration check: 0:00:01 ago on Wed 04 Mar 2020 09:22:39 AM KST. Dependencies resolved. ========================================================================================================================================================================================================= Package Arch Version Repository Size ========================================================================================================================================================================================================= Installing: boost-program-options x86_64 1.66.0-6.el8 AppStream 143 k Transaction Summary ========================================================================================================================================================================================================= Install 1 Package Total download size: 143 k Installed size: 686 k Downloading Packages: boost-program-options-1.66.0-6.el8.x86_64.rpm 140 kB/s | 143 kB 00:01 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 107 kB/s | 143 kB 00:01 warning: /var/cache/dnf/AppStream-a520ed22b0a8a736/packages/boost-program-options-1.66.0-6.el8.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 8483c65d: NOKEY CentOS-8 - AppStream 1.2 MB/s | 1.6 kB 00:00 Importing GPG key 0x8483C65D: Userid : "CentOS (CentOS Official Signing Key)" Fingerprint: 99DB 70FA E1D7 CE22 7FB6 4882 05B5 55B3 8483 C65D From : /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial Key imported successfully Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : boost-program-options-1.66.0-6.el8.x86_64 1/1 Running scriptlet: boost-program-options-1.66.0-6.el8.x86_64 1/1 Verifying : boost-program-options-1.66.0-6.el8.x86_64 1/1 Installed: boost-program-options-1.66.0-6.el8.x86_64 Complete!
MariaDB-server 설치하기
dnf install 명령으로 MariaDB 에 필요한 패키지를 설치합니다.
[dnf install MariaDB-server MariaDB-client --disablerepo=AppStream -y]
[root@RunIT ~]# dnf install MariaDB-server MariaDB-client --disablerepo=AppStream -y Last metadata expiration check: 0:00:20 ago on Wed 04 Mar 2020 11:03:54 AM KST. Dependencies resolved. ========================================================================================================================================================================================================= Package Arch Version Repository Size ========================================================================================================================================================================================================= Installing: MariaDB-client x86_64 10.4.12-1.el8 mariadb 12 M MariaDB-server x86_64 10.4.12-1.el8 mariadb 26 M Installing dependencies: libaio x86_64 0.3.112-1.el8 BaseOS 33 k lsof x86_64 4.91-2.el8 BaseOS 253 k perl-Carp noarch 1.42-396.el8 BaseOS 30 k perl-DBI x86_64 1.641-1.el8 BaseOS 740 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-common x86_64 10.4.12-1.el8 mariadb 87 k galera-4 x86_64 26.4.3-1.rhel8.0.el8 mariadb 13 M [147/718] Transaction Summary ========================================================================================================================================================================================================= Install 43 Packages Total download size: 64 M Installed size: 234 M Downloading Packages: (1/43): libaio-0.3.112-1.el8.x86_64.rpm 2.2 MB/s | 33 kB 00:00 (2/43): lsof-4.91-2.el8.x86_64.rpm 12 MB/s | 253 kB 00:00 (3/43): perl-Carp-1.42-396.el8.noarch.rpm 1.2 MB/s | 30 kB 00:00 (4/43): perl-Data-Dumper-2.167-399.el8.x86_64.rpm 6.1 MB/s | 58 kB 00:00 (5/43): perl-Errno-1.28-416.el8.x86_64.rpm 7.5 MB/s | 76 kB 00:00 (6/43): perl-Exporter-5.72-396.el8.noarch.rpm 5.6 MB/s | 34 kB 00:00 (7/43): perl-File-Path-2.15-2.el8.noarch.rpm 4.5 MB/s | 38 kB 00:00 (8/43): perl-File-Temp-0.230.600-1.el8.noarch.rpm 6.1 MB/s | 63 kB 00:00 (9/43): perl-Encode-2.97-3.el8.x86_64.rpm 26 MB/s | 1.5 MB 00:00 (10/43): perl-Getopt-Long-2.50-4.el8.noarch.rpm 3.7 MB/s | 63 kB 00:00 (11/43): perl-DBI-1.641-1.el8.x86_64.rpm 9.7 MB/s | 740 kB 00:00 (12/43): perl-HTTP-Tiny-0.074-1.el8.noarch.rpm 4.8 MB/s | 58 kB 00:00 (13/43): perl-MIME-Base64-3.15-396.el8.x86_64.rpm 3.7 MB/s | 31 kB 00:00 (14/43): perl-Math-BigInt-1.9998.11-7.el8.noarch.rpm 18 MB/s | 196 kB 00:00 (15/43): perl-IO-1.38-416.el8.x86_64.rpm 5.9 MB/s | 141 kB 00:00 (16/43): perl-Math-Complex-1.59-416.el8.noarch.rpm 8.6 MB/s | 108 kB 00:00 (17/43): perl-Pod-Escapes-1.07-395.el8.noarch.rpm 2.5 MB/s | 20 kB 00:00 (18/43): perl-Pod-Perldoc-3.28-396.el8.noarch.rpm 9.5 MB/s | 86 kB 00:00 (19/43): perl-Pod-Simple-3.35-395.el8.noarch.rpm 20 MB/s | 213 kB 00:00 (20/43): perl-Pod-Usage-1.69-395.el8.noarch.rpm 5.1 MB/s | 34 kB 00:00 (21/43): perl-PathTools-3.74-1.el8.x86_64.rpm 3.5 MB/s | 90 kB 00:00 (22/43): perl-Scalar-List-Utils-1.49-2.el8.x86_64.rpm 9.2 MB/s | 68 kB 00:00 (23/43): perl-Socket-2.027-3.el8.x86_64.rpm 6.3 MB/s | 59 kB 00:00 (24/43): perl-Storable-3.11-3.el8.x86_64.rpm 13 MB/s | 98 kB 00:00 (25/43): perl-Term-ANSIColor-4.06-396.el8.noarch.rpm 6.6 MB/s | 46 kB 00:00 (26/43): perl-Term-Cap-1.17-395.el8.noarch.rpm 2.9 MB/s | 23 kB 00:00 (27/43): perl-Text-Tabs+Wrap-2013.0523-395.el8.noarch.rpm 5.3 MB/s | 24 kB 00:00 (28/43): perl-Text-ParseWords-3.30-395.el8.noarch.rpm 2.3 MB/s | 18 kB 00:00 (29/43): perl-Unicode-Normalize-1.25-396.el8.x86_64.rpm 13 MB/s | 82 kB 00:00 (30/43): perl-Time-Local-1.280-1.el8.noarch.rpm 4.2 MB/s | 34 kB 00:00 (31/43): perl-constant-1.33-396.el8.noarch.rpm 3.6 MB/s | 25 kB 00:00 (32/43): perl-macros-5.26.3-416.el8.x86_64.rpm 5.9 MB/s | 72 kB 00:00 (33/43): perl-parent-0.237-1.el8.noarch.rpm 1.9 MB/s | 20 kB 00:00 (34/43): perl-podlators-4.11-1.el8.noarch.rpm 6.3 MB/s | 118 kB 00:00 (35/43): perl-libs-5.26.3-416.el8.x86_64.rpm 27 MB/s | 1.6 MB 00:00 (36/43): perl-threads-2.21-2.el8.x86_64.rpm 3.4 MB/s | 61 kB 00:00 (37/43): perl-threads-shared-1.58-2.el8.x86_64.rpm 5.1 MB/s | 48 kB 00:00 (38/43): rsync-3.1.3-6.el8.x86_64.rpm 23 MB/s | 405 kB 00:00 (39/43): perl-interpreter-5.26.3-416.el8.x86_64.rpm 13 MB/s | 6.3 MB 00:00 (40/43): MariaDB-common-10.4.12-1.el8.x86_64.rpm 74 kB/s | 87 kB 00:01 (41/43): MariaDB-client-10.4.12-1.el8.x86_64.rpm 2.2 MB/s | 12 MB 00:05 (42/43): galera-4-26.4.3-1.rhel8.0.el8.x86_64.rpm 2.6 MB/s | 13 MB 00:04 (43/43): MariaDB-server-10.4.12-1.el8.x86_64.rpm 3.2 MB/s | 26 MB 00:08 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------[96/718] Total 6.8 MB/s | 64 MB 00:09 warning: /var/cache/dnf/mariadb-8e0daa38f21ca158/packages/MariaDB-client-10.4.12-1.el8.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 1bb943db: NOKEY MariaDB 8.6 kB/s | 8.2 kB 00:00 Importing GPG key 0x1BB943DB: Userid : "MariaDB Package Signing Key" 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/43 Installing : perl-libs-4:5.26.3-416.el8.x86_64 2/43 Installing : perl-Carp-1.42-396.el8.noarch 3/43 Installing : perl-Scalar-List-Utils-3:1.49-2.el8.x86_64 4/43 Installing : perl-parent-1:0.237-1.el8.noarch 5/43 Installing : perl-Text-ParseWords-3.30-395.el8.noarch 6/43 Running scriptlet: MariaDB-common-10.4.12-1.el8.x86_64 7/43 Installing : MariaDB-common-10.4.12-1.el8.x86_64 7/43 Running scriptlet: MariaDB-common-10.4.12-1.el8.x86_64 7/43 Installing : libaio-0.3.112-1.el8.x86_64 8/43 Installing : perl-Term-ANSIColor-4.06-396.el8.noarch 9/43 Installing : perl-macros-4:5.26.3-416.el8.x86_64 10/43 Installing : perl-Errno-1.28-416.el8.x86_64 11/43 Installing : perl-Socket-4:2.027-3.el8.x86_64 12/43 Installing : perl-Text-Tabs+Wrap-2013.0523-395.el8.noarch 13/43 Installing : perl-Unicode-Normalize-1.25-396.el8.x86_64 14/43 Installing : perl-File-Path-2.15-2.el8.noarch 15/43 Installing : perl-IO-1.38-416.el8.x86_64 16/43 Installing : perl-PathTools-3.74-1.el8.x86_64 17/43 Installing : perl-constant-1.33-396.el8.noarch 18/43 Installing : perl-threads-1:2.21-2.el8.x86_64 19/43 Installing : perl-threads-shared-1.58-2.el8.x86_64 20/43 Installing : perl-interpreter-4:5.26.3-416.el8.x86_64 21/43 Installing : perl-File-Temp-0.230.600-1.el8.noarch 22/43 Installing : perl-Data-Dumper-2.167-399.el8.x86_64 23/43 Installing : perl-MIME-Base64-3.15-396.el8.x86_64 24/43 Installing : perl-Storable-1:3.11-3.el8.x86_64 25/43 Installing : perl-Math-Complex-1.59-416.el8.noarch 26/43 Installing : perl-Math-BigInt-1:1.9998.11-7.el8.noarch 27/43 Installing : perl-Pod-Escapes-1:1.07-395.el8.noarch 28/43 Installing : perl-Term-Cap-1.17-395.el8.noarch 29/43 Installing : perl-Time-Local-1:1.280-1.el8.noarch 30/43 Installing : perl-HTTP-Tiny-0.074-1.el8.noarch 31/43 Installing : perl-Encode-4:2.97-3.el8.x86_64 32/43 Installing : perl-Pod-Perldoc-3.28-396.el8.noarch 33/43 Installing : perl-Pod-Simple-1:3.35-395.el8.noarch 34/43 Installing : perl-Getopt-Long-1:2.50-4.el8.noarch [45/718] Installing : perl-Pod-Usage-4:1.69-395.el8.noarch 36/43 Installing : perl-podlators-4.11-1.el8.noarch 37/43 Installing : perl-DBI-1.641-1.el8.x86_64 38/43 Running scriptlet: MariaDB-client-10.4.12-1.el8.x86_64 39/43 Installing : MariaDB-client-10.4.12-1.el8.x86_64 39/43 Running scriptlet: MariaDB-client-10.4.12-1.el8.x86_64 39/43 Running scriptlet: galera-4-26.4.3-1.rhel8.0.el8.x86_64 40/43 Installing : galera-4-26.4.3-1.rhel8.0.el8.x86_64 40/43 Running scriptlet: galera-4-26.4.3-1.rhel8.0.el8.x86_64 40/43 Installing : rsync-3.1.3-6.el8.x86_64 41/43 Installing : lsof-4.91-2.el8.x86_64 42/43 Running scriptlet: MariaDB-server-10.4.12-1.el8.x86_64 43/43 Installing : MariaDB-server-10.4.12-1.el8.x86_64 43/43 Running scriptlet: MariaDB-server-10.4.12-1.el8.x86_64 43/43 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, 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 The MariaDB Knowledgebase at http://mariadb.com/kb or the MySQL manual for more instructions. Please report any problems at http://mariadb.org/jira The latest information about MariaDB is available at http://mariadb.org/. You can find additional information about the MySQL part at: http://dev.mysql.com Consider joining MariaDB's strong and vibrant community: https://mariadb.org/get-involved/ Verifying : libaio-0.3.112-1.el8.x86_64 1/43 Verifying : lsof-4.91-2.el8.x86_64 2/43 Verifying : perl-Carp-1.42-396.el8.noarch 3/43 Verifying : perl-DBI-1.641-1.el8.x86_64 4/43 Verifying : perl-Data-Dumper-2.167-399.el8.x86_64 5/43 Verifying : perl-Encode-4:2.97-3.el8.x86_64 6/43 Verifying : perl-Errno-1.28-416.el8.x86_64 7/43 Verifying : perl-Exporter-5.72-396.el8.noarch 8/43 Verifying : perl-File-Path-2.15-2.el8.noarch 9/43 Verifying : perl-File-Temp-0.230.600-1.el8.noarch 10/43 Verifying : perl-Getopt-Long-1:2.50-4.el8.noarch 11/43 Verifying : perl-HTTP-Tiny-0.074-1.el8.noarch 12/43 Verifying : perl-IO-1.38-416.el8.x86_64 13/43 Verifying : perl-MIME-Base64-3.15-396.el8.x86_64 14/43 Verifying : perl-Math-BigInt-1:1.9998.11-7.el8.noarch 15/43 Verifying : perl-Math-Complex-1.59-416.el8.noarch 16/43 Verifying : perl-PathTools-3.74-1.el8.x86_64 17/43 Verifying : perl-Pod-Escapes-1:1.07-395.el8.noarch 18/43 Verifying : perl-Pod-Perldoc-3.28-396.el8.noarch 19/43 Verifying : perl-Pod-Simple-1:3.35-395.el8.noarch 20/43 Verifying : perl-Pod-Usage-4:1.69-395.el8.noarch 21/43 Verifying : perl-Scalar-List-Utils-3:1.49-2.el8.x86_64 22/43 Verifying : perl-Socket-4:2.027-3.el8.x86_64 23/43 Verifying : perl-Storable-1:3.11-3.el8.x86_64 24/43 Verifying : perl-Term-ANSIColor-4.06-396.el8.noarch 25/43 Verifying : perl-Term-Cap-1.17-395.el8.noarch 26/43 Verifying : perl-Text-ParseWords-3.30-395.el8.noarch 27/43 Verifying : perl-Text-Tabs+Wrap-2013.0523-395.el8.noarch 28/43 Verifying : perl-Time-Local-1:1.280-1.el8.noarch 29/43 Verifying : perl-Unicode-Normalize-1.25-396.el8.x86_64 30/43 Verifying : perl-constant-1.33-396.el8.noarch 31/43 Verifying : perl-interpreter-4:5.26.3-416.el8.x86_64 32/43 Verifying : perl-libs-4:5.26.3-416.el8.x86_64 33/43 Verifying : perl-macros-4:5.26.3-416.el8.x86_64 34/43 Verifying : perl-parent-1:0.237-1.el8.noarch 35/43 Verifying : perl-podlators-4.11-1.el8.noarch 36/43 Verifying : perl-threads-1:2.21-2.el8.x86_64 37/43 Verifying : perl-threads-shared-1.58-2.el8.x86_64 38/43 Verifying : rsync-3.1.3-6.el8.x86_64 39/43 Verifying : MariaDB-client-10.4.12-1.el8.x86_64 40/43 Verifying : MariaDB-common-10.4.12-1.el8.x86_64 41/43 Verifying : MariaDB-server-10.4.12-1.el8.x86_64 42/43 Verifying : galera-4-26.4.3-1.rhel8.0.el8.x86_64 43/43 Installed: MariaDB-client-10.4.12-1.el8.x86_64 MariaDB-server-10.4.12-1.el8.x86_64 libaio-0.3.112-1.el8.x86_64 lsof-4.91-2.el8.x86_64 perl-Carp-1.42-396.el8.noarch perl-DBI-1.641-1.el8.x86_64 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-common-10.4.12-1.el8.x86_64 galera-4-26.4.3-1.rhel8.0.el8.x86_64 Complete!
MariaDB 서비스 시작하기
[systemctl start mariadb]
MariaDB 서비스 상태 확인하기
[systemctl status mariadb]
[root@RunIT ~]# systemctl status mariadb ● mariadb.service - MariaDB 10.4.12 database server Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled) Drop-In: /etc/systemd/system/mariadb.service.d └─migrated-from-my.cnf-settings.conf Active: active (running) since Wed 2020-03-04 11:26:40 KST; 30s ago Docs: man:mysqld(8) https://mariadb.com/kb/en/library/systemd/ Process: 11932 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS) Process: 11889 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ] && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1> Process: 11887 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS) Main PID: 11900 (mysqld) Status: "Taking your SQL requests now..." Tasks: 30 (limit: 12176) Memory: 71.9M CGroup: /system.slice/mariadb.service └─11900 /usr/sbin/mysqld Mar 04 11:26:40 CentOS8-Template mysqld[11900]: 2020-03-04 11:26:40 0 [Note] InnoDB: 10.4.12 started; log sequence number 60972; transaction id 21 Mar 04 11:26:40 CentOS8-Template mysqld[11900]: 2020-03-04 11:26:40 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool Mar 04 11:26:40 CentOS8-Template mysqld[11900]: 2020-03-04 11:26:40 0 [Note] InnoDB: Buffer pool(s) load completed at 200304 11:26:40 Mar 04 11:26:40 CentOS8-Template mysqld[11900]: 2020-03-04 11:26:40 0 [Note] Plugin 'FEEDBACK' is disabled. Mar 04 11:26:40 CentOS8-Template mysqld[11900]: 2020-03-04 11:26:40 0 [Note] Server socket created on IP: '::'. Mar 04 11:26:40 CentOS8-Template mysqld[11900]: 2020-03-04 11:26:40 0 [Note] Reading of all Master_info entries succeeded Mar 04 11:26:40 CentOS8-Template mysqld[11900]: 2020-03-04 11:26:40 0 [Note] Added new Master_info '' to hash table Mar 04 11:26:40 CentOS8-Template mysqld[11900]: 2020-03-04 11:26:40 0 [Note] /usr/sbin/mysqld: ready for connections. Mar 04 11:26:40 CentOS8-Template mysqld[11900]: Version: '10.4.12-MariaDB' socket: '/var/lib/mysql/mysql.sock' port: 3306 MariaDB Server Mar 04 11:26:40 CentOS8-Template systemd[1]: Started MariaDB 10.4.12 database server.
MariaDB 서비스 등록하기
systemctl 을 통해 서비스 등록하게 되면 부팅 시 자동으로 시작됩니다.
[systemctl enable mariadb]
[root@RunIT ~]# 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.
MariaDB root 비밀번호 및 보안 설정하기
mysql_secure_installation 명령을 실행하여 root 초기 패스워드를 설정할 수 있습니다.
[mysql_secure_installation]
[root@RunIT ~]# mysql_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): << Enter 키를 누릅니다. 기존에 설정한 암호가 없습니다. OK, successfully used password, moving on... Setting the root password or using the unix_socket ensures that nobody can log into the MariaDB root user without the proper authorisation. You already have your root account protected, so you can safely answer 'n'. Switch to unix_socket authentication [Y/n] N << 패스워드 인증을 활성화 하기 위해 소켓 인증을 사용하지 않습니다. ... skipping. You already have your root account protected, so you can safely answer 'n'. Change the root password? [Y/n] Y << MariaDB root 암호를 설정합니다. New password: << root 암호 입력 Re-enter new password: << root 암호 재입력 Password updated successfully! Reloading privilege tables.. ... Success! By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] Y << Anonymous 계정 삭제합니다. ... 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 << 원격에서 root 로그인을 금지합니다. ... 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 << test 데이터베이스를 삭제합니다. - 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!
MariaDB 접속하기
설정한 root 암호를 입력해서 MariaDB 에 로그인합니다.
[mysql -u root -p]
[root@RunIT ~]# mysql -u root -p Enter password: << root 암호 입력 Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 16 Server version: 10.4.12-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)]>
마무리
CentOS 8에서 MariaDB 10.4 설치하는 방법에 대해 알아보았습니다.
실습 내용을 참고해서 MariaDB를 쉽게 설치할 수 있습니다.
COMMENTS