Linux/CentOS

CentOS 7 에 MariaDB 설치

조영래 2017. 8. 9. 16:42

MariaDB 설치

 # yum install mariadb mariadb-server


설정 파일 변경

 # vi /etc/my.cnf 


character-set-server=utf8
 collation-server=utf8_general_ci


서비스 등록 및 시작

 # systemctl enable mariadb 
 # systemctl start mariadb


admin 패스워드 변경

 # mysqladmin password


client 실행

 # mysql -u 사용자 -p패스워드


database 생성 및 사용자 추가(권한 설정)

create user 'user명'@'%' identified by '패스워드';
 create user 'user명'@'localhost' identified by '패스워드';
 flush privileges;
 create database DB명;
 grant all privileges on DB명.* to 'user명'@'%';
 grant all privileges on DB명.* to 'user명'@'localhost';


외부에서 접근 가능 하도록 방화벽 해제

 # firewall-cmd --permanent --zone=public --add-port=3306/tcp 


재부팅

 # reboot