Load To Technical Architect
[Linux] MariaDB 10.5.8 설치 본문
- Server Spec -
CPU - 2core
RAM - 4GB
OS - CentOS 7
1. Mariadb 설치에 필요한 패키지 설치
# yum -y install ncurses*
2. Mariadb 서비스 사용자 추가
# useradd maria
3. Mariadb 소스 파일 다운로드 후 압축 해제
# tar -xzf mariadb-10.5.8-linux-systemd-x86_64.tar.gz
4. datafile, log 폴더 생성
# mkdir /usr/local/src/mariadb-10.5.8-linux-systemd-x86_64/log
# mkdir /usr/local/src/mariadb-10.5.8-linux-systemd-x86_64/mysql
5. 소스 파일 소유 권한을 Mariadb 사용자로 지정
# chown -R maria:maria mariadb-10.5.8-linux-systemd-x86_64
6. my.cnf 수정 ( Path )
[client]
port = 3306
socket = /tmp/mysql.sock
default-character-set=utf8
[mysqld]
# Character Set
init_connect = SET collation_connection = utf8_general_ci
init_connect = SET NAMES utf8
character-set-server=utf8
skip-character-set-client-handshake
collation-server = utf8_general_ci
# Basic Settings
basedir = /usr/local/src/mariadb-10.5.8-linux-systemd-x86_64
datadir = /usr/local/src/mariadb-10.5.8-linux-systemd-x86_64/mysql
socket = /tmp/mysql.sock
skip-external-locking
# Engine
default-storage-engine = InnoDB
# Safety
max-connect-errors = 1000000
max_allowed_packet = 64M
skip-name-resolve
sysdate-is-now = 1
innodb-strict-mode = 1
# Buffers
sort_buffer_size = 4M
read_buffer_size = 2M
join_buffer_size = 8M
# MyISAM
key-buffer-size = 32M
myisam_sort_buffer_size = 64M
# CACHES AND LIMITS #
tmp-table-size = 128M
max-heap-table-size = 128M
query-cache-type = 0
query-cache-size = 0
query_cache_limit = 1M
max-connections = 214
thread-cache-size = 50
thread_stack = 192K
open-files-limit = 1024
table-definition-cache = 1024
table-open-cache = 400
# InnoDB
innodb-buffer-pool-size = 2048M
innodb_buffer_pool_instances = 8
innodb_log_buffer_size = 8M
innodb-log-files-in-group = 2
innodb-log-file-size = 256M
innodb-file-per-table = 1
innodb-flush-log-at-trx-commit = 1
innodb-flush-method = O_DIRECT
symbolic-links=0
explicit_defaults_for_timestamp = 1
[mysqld_safe]
log-error=/usr/local/src/mariadb-10.5.8-linux-systemd-x86_64/log/mariadb.log
pid-file=/usr/local/src/mariadb-10.5.8-linux-systemd-x86_64/mysql/mariadb.pid
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
7. mariadb-install-db 스크립트 실행
# /usr/local/src/mariadb-10.5.8-linux-systemd-x86_64/scripts/mariadb-install-db --user=maria --basedir=/usr/local/src/mariadb-10.5.8-linux-systemd-x86_64
8. mariadb 실행
# /usr/local/src/mariadb-10.5.8-linux-systemd-x86_64/bin/mariadbd --skip-grant
9. mariadb 접속
# /usr/local/src/mariadb-10.5.8-linux-systemd-x86_64/bin/mariadb -u root -p
Enter password: <아무 입력 없이 Enter>
10. root password 수정
MariaDB [(none)]> select password('root');
+-------------------------------------------+
| password('root') |
+-------------------------------------------+
| *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
+-------------------------------------------+
MariaDB [(none)]> select * from mysql.global_priv where User='root';
+-----------+------+--------------------------------------------------------------------------------------------------------------------------------------------+
| Host | User | Priv |
+-----------+------+--------------------------------------------------------------------------------------------------------------------------------------------+
| localhost | root | {"access":18446744073709551615,"plugin":"mysql_native_password","authentication_string":"invalid","auth_or":[{},{"plugin":"unix_socket"}]} |
+-----------+------+--------------------------------------------------------------------------------------------------------------------------------------------+
MariaDB [(none)]> update mysql.global_priv set Priv='{"access":18446744073709551615,"plugin":"mysql_native_password","authentication_string":"*81F5E21E35407D884A6CD4A731AEBFB6AF209E1B","auth_or":[{},{"plugin":"unix_socket"}]}' where User='root';
MariaDB [(none)]> quit
※ "authentication_string":"invalid" 부분을 처음에 조회한 root password string으로 변경
11. mariadb 종료
# ps -ef | grep maria
# kill -9 < mariadbd --skip-grant proccess >
12. mariadb 실행
# /usr/local/src/mariadb-10.5.8-linux-systemd-x86_64/bin/mariadbd
13. mariadb 접속
# /usr/local/src/mariadb-10.5.8-linux-systemd-x86_64/bin/mariadb -u root -p
Enter password: root
14. root password 변경
MariaDB [(none)]> alter user root@'localhost' identified by '<비밀번호>';
15. 설치 완료
'DB > mariadb' 카테고리의 다른 글
[Linux] Mariadb Service 등록 (0) | 2020.12.17 |
---|