마리아DB 설치
yum -y install mariadb-server mariadb
systemctl start mariadb - mariadb 시작
마리아 DB 초기 셋팅
(1) 설정
- 테이블 대소문자 무시
vi /etc/my.cnf.d/mariadb-server.cnf
[mysqld]
# 0 : 대소문자 구분, 1 : 대소문자 구분하지 안함 (소문자로 저장), 2 : 대소문자 구분하지 안함 (소문자로 비교)
lower_case_table_names = 1
추가
collation-server = utf8_unicode_ci
init-connect='SET NAMES utf8'
character-set-server = utf8
# systemctl stop mariadb
# systemctl start mariadb
# 마리아DB 접속
mysql -uroot
패스워드입력
# 적용 확인
show variables like 'lower_case_table_names';
(2) utf8
• vi /etc/my.cnf.d/client.cnf
[client]
default-character-set=utf8
• vi /etc/my.cnf.d/mysql-clients.cnf
[mysql]
default-character-set=utf8
[mysqldump]
default-character-set=utf8
sudo systemctl restart mariadb --> MariaDB 재시작
mysql -uroot 로 마리아 DB 접속 후
show variables like 'c%';로 인코딩 변경 확인
(3) 디비
- 디비 계정 생성
create user test_pos_user@localhost identified by 'test!123';
create user test_pos_user@'%' identified by 'test!123';
create user test_rnd_user@localhost identified by 'test!123';
create user test_rnd_user@'%' identified by 'test!123';
- 디비 생성
create database test_pos_db ;
create database test_rnd_db ;
show databases;
(4) 권한
- 로컬 권한
grant all privileges on test_pos_db.* to test_pos_user@localhost identified by 'pos_user!@#$%';
grant all privileges on test_rnd_db.* to test_rnd_user@localhost identified by 'rnd_user!@#$%';
- 모든 권한
grant all privileges on test_pos_db.* to test_pos_user@`%` identified by 'pos_user!@#$%' ;
grant all privileges on test_rnd_db.* to test_rnd_user@`%` identified by 'rnd_user!@#$%' ;
flush privileges; - 권한 적용
(5) 복구
mysql -uroot -p test_pos_db < /home/sql_src/test_pos_db/PAS_KCG_LICENSE.sql
(6) 마리아 DB 계정생성 및 모든 권한 부여하기
mysql -u root
use mysql;
select host, user from user;
create user 'root'@'192.168.0.205' identified by 'test!123';
grant all privileges on . to 'root'@'192.168.0.57';
grant all privileges on . to '사용자'@'localhost';
grant all privileges on DB이름.* to '사용자'@'localhost';
grant all privileges on DB이름.테이블명 to '사용자'@'localhost';
grant select on DB이름.테이블명 to '사용자'@'localhost';
grant select, insert on DB이름.테이블명 to '사용자'@'localhost';
grant update(컬럼1, 컬럼2) on DB이름.테이블명 to '사용자'@'localhost';
출처: https://jay-so.tistory.com/67 [제이제이:티스토리]