CentOS7 MariaDB 설치
"CentOS7 MariaDB 설치하기"
yum install MariaDB-server 로 MariaDB가 설치 안될 경우!
아래 사이트를 참고하면 좋다.
1. /etc/yum.repos.d/MariaDB.repo 파일 생성
# vim /etc/yum.repos.d/MariaDB.repo # MariaDB 10.1 CentOS repository list - created 2017-05-02 01:43 UTC # http://downloads.mariadb.org/mariadb/repositories/ [mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.1/centos7-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1 |
2. yum으로 MariaDB 설치
# yum install MariaDB-server MariaDB-client MariaDB-compat |
3. 메모리 설정
- 512MB: my-large.cnf
- 2GB: my-huge.cnf
- 4GB: my-innodb-heavy-4G.cnf
# cp -ar /usr/share/mysql/my-huge.cnf /etc/my.cnf.d/ |
4. MariaDB 옵션 설정
- 언어셋 및 용량 설정 (꼭 설정하지 않아도 되욤)
# vim /etc/my.cnf.d/server.cnf [client] default-character-set=utf8mb4 [mysql] default-character-set=utf8mb4 [mysqld] collation-server = utf8mb4_unicode_ci #init-connect='SET NAMES utf8mb4' character-set-server = utf8mb4 max_allowed_packet = 32M slow_query_log long_query_time = 2 [mysqldump] default-character-set=utf8mb4 max_allowed_packet = 32M |
5. MariaDB 서비스 설정 및 시작 그리고 확인
# systemctl start mariadb # systemctl enable mariadb # systemctl status mariadb |
6. 보안설정
- mysql_secure_installation 스크립트 실행으로 보안설정함
# mysql_secure_installation Enter current password for root (enter for none): ------------// 현재 root 패스워드 입력, 없으면 enter OK, successfully used password, moving on...
Set root password? [Y/n] y ---------------------// root 패스워드 설정 New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ... Success! Remove anonymous users? [Y/n] y -------------// 익명 사용자 삭제 ... Success! Disallow root login remotely? [Y/n] y ---------// root 원격 접속 설정 ... Success! Remove test database and access to it? [Y/n] y --------// test 데이터베이스 삭제 - Dropping test database... ... Success! - Removing privileges on test database... ... Success!
Reload privilege tables now? [Y/n] y --------------// privilege 테이블 재시작 ... 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! |
7. 데이터 베이스 접속
- 앞서 설정한 root 패스워드 입력
# mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 14 Server version: 10.1.22-MariaDB MariaDB Server Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> |
MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | +--------------------+ 3 rows in set (0.00 sec) |