DB
[DB] Rocky Linux 서버에 MariaDB 설치
현또다
2024. 10. 30. 13:27
▶ MariaDB 설치
1. MariaDB dnf Repository 추가
- 아래 경로에서 MariaDB 설치를 위한 서버 OS에 맞는 repository 확인 가능
https://mariadb.org/download/?t=repo-config
Download MariaDB Server - MariaDB.org
REST API Release Schedule Reporting Bugs … Continue reading "Download MariaDB Server"
mariadb.org
- 아래와 같이 Repository 항목 확인 후 복사하여 사용
vi /etc/yum.repos.d/mariaDB.repo # repository 항목 작성
[mariadb]
name = MariaDB
baseurl = https://tw1.mirror.blendbyte.net/mariadb/yum/11.4/rhel/$releasever/$basearch
module_hotfixes = 1
gpgcheck = 0
enabled=1
dnf clean all; dnf repolist # MariaDB 저장소 확인
2. MariaDB 설치 및 활성화
dnf install MariaDB-server MariaDB-client
systemctl enable --now mariadb # mariadb 활성화
systemctl status mariadb
3. 데이터베이스 접속 확인 및 권한 설정
mysql -u root -p # DB 접속
- root 계정에 대한 외부 접속 권한 설정
# 특정 데이터베이스 및 테이블에 특정 IP 대역 접근 허용
MariaDB [(none)]> grant all privileges on [Database명].[Table명] to ‘root’@‘192.168.%’ identified by ‘[root의 password]’;
# 모든 데이터베이스 및 테이블에 모든 외부 IP 접근 허용
MariaDB [(none)]> grant all privileges on *.* to ‘root’@‘%’ identified by ‘[root의 password]’;
# 현재 사용중인 mysql의 캐시 삭제 및 새로운 설정 적용
flush privileges;
- my.cnf 설정 파일 변경
vi /etc/my.cnf.d/server.cnf
# bind-address = 127.0.0.1 # 주석 처리
bind-address = 0.0.0.0
- 접속 확인