[MariaDB] 2. CentOS 7에 MariaDB 10.5 설치하기

2020. 9. 12. 14:22DB/MariaDB

300x250
반응형
  1. MariaDB repository setup
  2. MariaDB 패키지 설치
  3. MariaDB Server 시작
  4. MariaDB 접속

1. MariaDB repository setup

MariaDB 사이트에서 제공하는 setup 스크립트를 이용하여 패키지를 설치합니다.

curl -LsS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash

setup 스크립트를 별도의 옵션없이 실행할경우, mariadb-10.5 버전의 os에 맞는 MariaDB 정보가 설정됩니다.
setup 스크립트에서 제공하고 있는 옵션은 MariaDB 메뉴얼을 참고해주세요.


2. MariaDB 패키지 설치

MariaDB Server를 사용하기 위한 패키지를 설치합니다.

sudo yum install MariaDB-server MariaDB-client MariaDB-backup
=======================================================================================================================================
 Package                                 Arch                   Version                             Repository                    Size
=======================================================================================================================================
Installing:
 MariaDB-backup                          x86_64                 10.5.8-1.el7.centos                 mariadb-main                 6.9 M
 MariaDB-client                          x86_64                 10.5.8-1.el7.centos                 mariadb-main                  13 M
 MariaDB-server                          x86_64                 10.5.8-1.el7.centos                 mariadb-main                  26 M
Installing for dependencies:
 MariaDB-common                          x86_64                 10.5.8-1.el7.centos                 mariadb-main                  81 k
 MariaDB-compat                          x86_64                 10.5.8-1.el7.centos                 mariadb-main                 2.2 M
 boost-program-options                   x86_64                 1.53.0-28.el7                       ol7_latest                   156 k
 galera-4                                x86_64                 26.4.6-1.el7.centos                 mariadb-main                 9.5 M
 pcre2                                   x86_64                 10.23-2.el7                         ol7_latest                   201 k
 perl-Compress-Raw-Bzip2                 x86_64                 2.061-3.el7                         ol7_latest                    32 k
 perl-Compress-Raw-Zlib                  x86_64                 1:2.061-4.el7                       ol7_latest                    57 k
 perl-DBI                                x86_64                 1.627-4.el7                         ol7_latest                   801 k
 perl-Data-Dumper                        x86_64                 2.145-3.el7                         ol7_latest                    47 k
 perl-IO-Compress                        noarch                 2.061-2.el7                         ol7_latest                   259 k
 perl-Net-Daemon                         noarch                 0.48-5.el7                          ol7_latest                    50 k
 perl-PlRPC                              noarch                 0.2020-14.el7                       ol7_latest                    35 k
 socat                                   x86_64                 1.7.3.2-2.el7                       ol7_latest                   289 k

Transaction Summary
=======================================================================================================================================

3. MariaDB Server 시작

MariaDB 설치가 완료되었다면 MariaDB Server를 시작해봅시다.

sudo systemctl start mysqld

systemctl status 커맨드로 잘 실행되었는지 확인해봅니다.

sudo systemctl status mysqld
● mariadb.service - MariaDB 10.5.8 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 Fri 2021-01-15 02:47:16 GMT; 2s ago
     Docs: man:mariadbd(8)
           https://mariadb.com/kb/en/library/systemd/
  Process: 23974 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
  Process: 23947 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
  Process: 23944 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
 Main PID: 23958 (mariadbd)
   Status: "Taking your SQL requests now..."
   CGroup: /system.slice/mariadb.service
           └─23958 /usr/sbin/mariadbd

Jan 15 02:47:16 abc mariadbd[23958]: 2021-01-15  2:47:16 0 [Note] InnoDB: 10.5.8 started; log sequence number 45118; transaction id 20
Jan 15 02:47:16 abc mariadbd[23958]: 2021-01-15  2:47:16 0 [Note] Plugin 'FEEDBACK' is disabled.
Jan 15 02:47:16 abc mariadbd[23958]: 2021-01-15  2:47:16 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
Jan 15 02:47:16 abc mariadbd[23958]: 2021-01-15  2:47:16 0 [Note] InnoDB: Buffer pool(s) load completed at 210115  2:47:16
Jan 15 02:47:16 abc mariadbd[23958]: 2021-01-15  2:47:16 0 [Note] Server socket created on IP: '::'.
Jan 15 02:47:16 abc mariadbd[23958]: 2021-01-15  2:47:16 0 [Note] Reading of all Master_info entries succeeded
Jan 15 02:47:16 abc mariadbd[23958]: 2021-01-15  2:47:16 0 [Note] Added new Master_info '' to hash table
Jan 15 02:47:16 abc mariadbd[23958]: 2021-01-15  2:47:16 0 [Note] /usr/sbin/mariadbd: ready for connections.
Jan 15 02:47:16 abc mariadbd[23958]: Version: '10.5.8-MariaDB'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MariaDB Server
Jan 15 02:47:16 abc systemd[1]: Started MariaDB 10.5.8 database server.
Hint: Some lines were ellipsized, use -l to show in full.

위와 같이 Active상태가 active로 출력된다면 정상적으로 실행된 것입니다.


4. MariaDB 접속

CentOS 7에서 mariadb 10.5 버전을 설치하였습니다.
sudo 를 이용하여 mysql 에 접속해봅시다.

sudo mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 6
Server version: 10.5.8-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)]>

MariaDB 접속에 성공하였습니다.

current_user() 함수를 이용하여 현재 로그인중인 계정을 확인해봅니다.

select current_user();
+----------------+
| current_user() |
+----------------+
| root@localhost |
+----------------+

sudo를 이용하여 로그인하였기 때문에 root 권한으로 로그인되었습니다.

계정을 추가하는 방법을 추후 별도의 포스트로 추가 설명하도록 하고, 다음 포스팅은 DDL에 관한 설명을 시작합니다.

300x250
반응형

TAG