CentOS7 MariaDB 설치

  다른 뜻에 대해서는 CentOS6 MariaDB 설치 문서를 참조하십시오.
  다른 뜻에 대해서는 우분투 MariaDB 설치 문서를 참조하십시오.

1 개요[ | ]

리눅스 MariaDB 설치
CentOS MariaDB 설치

2 repo 설정[ | ]

[root@zabbix1 ~]# vi /etc/yum.repos.d/MariaDB.repo
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.4/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

3 설치[ | ]

[root@zetawiki ~]# yum install MariaDB
... (생략)
=============================================================================================
 Package                      Arch        Version                         Repository    Size
=============================================================================================
Installing:
 MariaDB-server               x86_64      10.4.5-1.el7.centos             mariadb       25 M
Installing for dependencies:
 MariaDB-client               x86_64      10.4.5-1.el7.centos             mariadb       12 M
 MariaDB-common               x86_64      10.4.5-1.el7.centos             mariadb       81 k
 MariaDB-compat               x86_64      10.4.5-1.el7.centos             mariadb      2.8 M
 boost-program-options        x86_64      1.53.0-27.el7                   base         156 k
 galera-4                     x86_64      26.4.2-1.rhel7.el7.centos       mariadb      9.4 M
 groff-base                   x86_64      1.22.2-8.el7                    base         942 k
 iproute                      x86_64      4.11.0-14.el7_6.2               updates      764 k
 iptables                     x86_64      1.4.21-28.el7                   base         433 k
 libaio                       x86_64      0.3.109-13.el7                  base          24 k
 libmnl                       x86_64      1.0.3-7.el7                     base          23 k
 libnetfilter_conntrack       x86_64      1.0.6-1.el7_3                   base          55 k
 libnfnetlink                 x86_64      1.0.1-4.el7                     base          26 k
 lsof                         x86_64      4.87-6.el7                      base         331 k
 make                         x86_64      1:3.82-23.el7                   base         420 k
 openssl                      x86_64      1:1.0.2k-16.el7_6.1             updates      493 k
 perl                         x86_64      4:5.16.3-294.el7_6              updates      8.0 M
 perl-Carp                    noarch      1.26-244.el7                    base          19 k
 perl-Compress-Raw-Bzip2      x86_64      2.061-3.el7                     base          32 k
 perl-Compress-Raw-Zlib       x86_64      1:2.061-4.el7                   base          57 k
 perl-DBI                     x86_64      1.627-4.el7                     base         802 k
 perl-Data-Dumper             x86_64      2.145-3.el7                     base          47 k
 perl-Encode                  x86_64      2.51-7.el7                      base         1.5 M
 perl-Exporter                noarch      5.68-3.el7                      base          28 k
 perl-File-Path               noarch      2.09-2.el7                      base          26 k
 perl-File-Temp               noarch      0.23.01-3.el7                   base          56 k
 perl-Filter                  x86_64      1.49-3.el7                      base          76 k
 perl-Getopt-Long             noarch      2.40-3.el7                      base          56 k
 perl-HTTP-Tiny               noarch      0.033-3.el7                     base          38 k
 perl-IO-Compress             noarch      2.061-2.el7                     base         260 k
 perl-Net-Daemon              noarch      0.48-5.el7                      base          51 k
 perl-PathTools               x86_64      3.40-5.el7                      base          82 k
 perl-PlRPC                   noarch      0.2020-14.el7                   base          36 k
 perl-Pod-Escapes             noarch      1:1.04-294.el7_6                updates       51 k
 perl-Pod-Perldoc             noarch      3.20-4.el7                      base          87 k
 perl-Pod-Simple              noarch      1:3.28-4.el7                    base         216 k
 perl-Pod-Usage               noarch      1.63-3.el7                      base          27 k
 perl-Scalar-List-Utils       x86_64      1.27-248.el7                    base          36 k
 perl-Socket                  x86_64      2.010-4.el7                     base          49 k
 perl-Storable                x86_64      2.45-3.el7                      base          77 k
 perl-Text-ParseWords         noarch      3.29-4.el7                      base          14 k
 perl-Time-HiRes              x86_64      4:1.9725-3.el7                  base          45 k
 perl-Time-Local              noarch      1.2300-2.el7                    base          24 k
 perl-constant                noarch      1.27-2.el7                      base          19 k
 perl-libs                    x86_64      4:5.16.3-294.el7_6              updates      688 k
 perl-macros                  x86_64      4:5.16.3-294.el7_6              updates       44 k
 perl-parent                  noarch      1:0.225-244.el7                 base          12 k
 perl-podlators               noarch      2.5.1-3.el7                     base         112 k
 perl-threads                 x86_64      1.87-4.el7                      base          49 k
 perl-threads-shared          x86_64      1.43-6.el7                      base          39 k
 rsync                        x86_64      3.1.2-6.el7_6.1                 updates      404 k
Updating for dependencies:
 openssl-libs                 x86_64      1:1.0.2k-16.el7_6.1             updates      1.2 M

Transaction Summary
=============================================================================================
Install  1 Package  (+50 Dependent packages)
Upgrade             (  1 Dependent package)

Total download size: 67 M
Is this ok [y/d/N]: y
... (생략)
Installed:
  MariaDB-server.x86_64 0:10.4.5-1.el7.centos                                                

Dependency Installed:
  MariaDB-client.x86_64 0:10.4.5-1.el7.centos   MariaDB-common.x86_64 0:10.4.5-1.el7.centos 
  MariaDB-compat.x86_64 0:10.4.5-1.el7.centos   boost-program-options.x86_64 0:1.53.0-27.el7
  galera-4.x86_64 0:26.4.2-1.rhel7.el7.centos   groff-base.x86_64 0:1.22.2-8.el7            
  iproute.x86_64 0:4.11.0-14.el7_6.2            iptables.x86_64 0:1.4.21-28.el7             
  libaio.x86_64 0:0.3.109-13.el7                libmnl.x86_64 0:1.0.3-7.el7                 
  libnetfilter_conntrack.x86_64 0:1.0.6-1.el7_3 libnfnetlink.x86_64 0:1.0.1-4.el7           
  lsof.x86_64 0:4.87-6.el7                      make.x86_64 1:3.82-23.el7                   
  openssl.x86_64 1:1.0.2k-16.el7_6.1            perl.x86_64 4:5.16.3-294.el7_6              
  perl-Carp.noarch 0:1.26-244.el7               perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7
  perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7   perl-DBI.x86_64 0:1.627-4.el7               
  perl-Data-Dumper.x86_64 0:2.145-3.el7         perl-Encode.x86_64 0:2.51-7.el7             
  perl-Exporter.noarch 0:5.68-3.el7             perl-File-Path.noarch 0:2.09-2.el7          
  perl-File-Temp.noarch 0:0.23.01-3.el7         perl-Filter.x86_64 0:1.49-3.el7             
  perl-Getopt-Long.noarch 0:2.40-3.el7          perl-HTTP-Tiny.noarch 0:0.033-3.el7         
  perl-IO-Compress.noarch 0:2.061-2.el7         perl-Net-Daemon.noarch 0:0.48-5.el7         
  perl-PathTools.x86_64 0:3.40-5.el7            perl-PlRPC.noarch 0:0.2020-14.el7           
  perl-Pod-Escapes.noarch 1:1.04-294.el7_6      perl-Pod-Perldoc.noarch 0:3.20-4.el7        
  perl-Pod-Simple.noarch 1:3.28-4.el7           perl-Pod-Usage.noarch 0:1.63-3.el7          
  perl-Scalar-List-Utils.x86_64 0:1.27-248.el7  perl-Socket.x86_64 0:2.010-4.el7            
  perl-Storable.x86_64 0:2.45-3.el7             perl-Text-ParseWords.noarch 0:3.29-4.el7    
  perl-Time-HiRes.x86_64 4:1.9725-3.el7         perl-Time-Local.noarch 0:1.2300-2.el7       
  perl-constant.noarch 0:1.27-2.el7             perl-libs.x86_64 4:5.16.3-294.el7_6         
  perl-macros.x86_64 4:5.16.3-294.el7_6         perl-parent.noarch 1:0.225-244.el7          
  perl-podlators.noarch 0:2.5.1-3.el7           perl-threads.x86_64 0:1.87-4.el7            
  perl-threads-shared.x86_64 0:1.43-6.el7       rsync.x86_64 0:3.1.2-6.el7_6.1              

Dependency Updated:
  openssl-libs.x86_64 1:1.0.2k-16.el7_6.1                                                    

Complete!

4 확인[ | ]

[root@zetawiki ~]# rpm -qa | grep MariaDB
MariaDB-compat-10.4.5-1.el7.centos.x86_64
MariaDB-client-10.4.5-1.el7.centos.x86_64
MariaDB-common-10.4.5-1.el7.centos.x86_64
MariaDB-server-10.4.5-1.el7.centos.x86_64

5 DB 시작 / 패스워드 변경[ | ]

아까 나왔던 안내대로 DB를 시작하고 패스워드를 바꾼다.

[root@zetawiki ~]# systemctl start mariadb
[root@zetawiki ~]# /usr/bin/mysqladmin -u root password 'P@ssw0rd'
[root@zetawiki ~]#
[root@zetawiki ~]# netstat -anp | grep 3306
tcp6       0      0 :::3306                 :::*                    LISTEN      3479/mysqld
포트는 3306, 데몬이름은 mysqld이다.

6 접속 확인[ | ]

[root@zetawiki ~]# mysql -u root -p
Enter password: P@ssw0rd
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 5
Server version: 10.1.30-MariaDB MariaDB Server

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> quit
Bye
[root@zetawiki ~]#

7 부팅시 자동시작 설정 확인[ | ]

기본으로 설정되어 있지만 한번 더 확인

[root@zabbix1 ~]# systemctl is-enabled mariadb

enabled

8 같이 보기[ | ]

9 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}