+1-1+1-1+1-1+1-1...
MariaDB 설치 - YUM 본문
728x90
1. Yum Repository 등록
[root@localhost yum.repos.d]# 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
[root@localhost yum.repos.d]# yum repolist
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
repo id repo name status
base/x86_64 CentOS-7Server - Base 10,072
centosplus/x86_64 CentOS-7Server - Plus 56
extras/x86_64 CentOS-7Server - Extras 448
mariadb MariaDB 97
updates/x86_64 CentOS-7Server - Updates 1,155
repolist: 11,828
2. MariaDB 설치
[root@localhost yum.repos.d]# yum install MariaDB
Complete!
[root@localhost yum.repos.d]# rpm -qa | grep MariaDB
MariaDB-compat-10.4.17-1.el7.centos.x86_64
MariaDB-server-10.4.17-1.el7.centos.x86_64
MariaDB-common-10.4.17-1.el7.centos.x86_64
MariaDB-client-10.4.17-1.el7.centos.x86_64
3. MariaDB 실행 및 root 비밀번호 변경
t@localhost yum.repos.d]# systemctl start mariadb
[root@localhost yum.repos.d]# /usr/bin/mysqladmin -u root password P@ssw0rd
4. 서비스 포트 리스닝 상태 확인
[root@localhost yum.repos.d]# netstat -an | grep ":3306"
tcp6 0 0 :::3306 :::* LISTEN
5. Character Set 변경 후 서비스 재시작
* MariaDB는 utf8로 세팅하는 경우 emoji문자가 입력되지 않는다. 이를 지원하려면 utf8mb4로 세팅해야함
[root@localhost yum.repos.d]# vi /etc/my.cnf
#
# This group is read both by the client and the server
# use it for options that affect everything
#
[client-server]
#
# include *.cnf from the config directory
#
!includedir /etc/my.cnf.d
#아래 내용 추가
[mysqld]
default_storage_engine=innodb
init-connect='SET NAMES utf8mb4'
lower_case_table_names=1
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci
[client]
port=3306
default-character-set = utf8mb4
[mysqldump]
default-character-set = utf8mb4
[mysql]
default-character-set = utf8mb4
[root@localhost yum.repos.d]# systemctl restart mariadb
6. MariaDB 로그인, Character Set 확인
[root@localhost yum.repos.d]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 10.4.17-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)]> show variables like 'c%';
+----------------------------------+----------------------------+
| Variable_name | Value |
+----------------------------------+----------------------------+
| character_set_client | utf8mb4 |
| character_set_connection | utf8mb4 |
| character_set_database | utf8mb4 |
| character_set_filesystem | binary |
| character_set_results | utf8mb4 |
| character_set_server | utf8mb4 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
| check_constraint_checks | ON |
| collation_connection | utf8mb4_general_ci |
| collation_database | utf8mb4_unicode_ci |
| collation_server | utf8mb4_unicode_ci |
| column_compression_threshold | 100 |
| column_compression_zlib_level | 6 |
| column_compression_zlib_strategy | DEFAULT_STRATEGY |
| column_compression_zlib_wrap | OFF |
| completion_type | NO_CHAIN |
| concurrent_insert | AUTO |
| connect_timeout | 10 |
| core_file | OFF |
+----------------------------------+----------------------------+
20 rows in set (0.001 sec)
7. 리부팅 시 자동실행 설정
[root@localhost yum.repos.d]# systemctl enable mariadb
Created symlink from /etc/systemd/system/mysql.service to /usr/lib/systemd/system/mariadb.service.
Created symlink from /etc/systemd/system/mysqld.service to /usr/lib/systemd/system/mariadb.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[root@localhost yum.repos.d]# systemctl is-enabled mariadb
enabled
8. 클라이언트 Telnet 접속 상태 확인 - 접속 안됨
[root@localhost ~]# telnet 192.168.60.15 3306
Trying 192.168.60.15...
telnet: connect to address 192.168.60.15: No route to host
9 방화벽 설정
[root@localhost yum.repos.d]# firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: enp0s3 enp0s8
sources:
services: dhcpv6-client ssh
ports:
protocols:
masquerade: no
forward-ports:
sourceports:
icmp-blocks:
rich rules:
[root@localhost yum.repos.d]# firewall-cmd --permanent --add-port=3306/tcp
success
[root@localhost yum.repos.d]# firewall-cmd --reload
success
10. 클라이언트 Telnet 접속 상태 확인 - 접속 성공하였으나 외부IP 커넥션이 허용되지 않았다는 메시지가 나옴
[root@localhost ~]# telnet 192.168.60.15 3306
Trying 192.168.60.15...
Connected to 192.168.60.15.
Escape character is '^]'.
GHost '192.168.60.7' is not allowed to connect to this MariaDB serverConnection closed by foreign host.
반응형
'Linux > MySQL' 카테고리의 다른 글
MariaDB 복제 구성 하기 (0) | 2021.01.26 |
---|---|
MariaDB 원격 접속 허용하기 (0) | 2021.01.19 |
My SQL 계정 및 테이블 생성 절차 예제 (0) | 2020.12.30 |