- 패키지 저장소 업데이트
$ sudo dnf update
- https://mariadb.org/download/로 이동하여 자신에게 맞는 배포 및 버전 선택
distribution, MariaDB Server viersion, Mirror 모두 선택하면 아래에 다음과 비슷한 설정 파일이 나옴
/etc/yum/repos.d/MariaDB.repo
파일 생성 후 저장
# MariaDB 10.6 CentOS repository list - created 2021-09-19 12:52 UTC
# https://mariadb.org/download/
[mariadb]
name = MariaDB
baseurl = https://mirror.yongbok.net/mariadb/yum/10.6/centos8-amd64
module_hotfixes=1
gpgkey=https://mirror.yongbok.net/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck=1
- MariaDB-server 설치
$ sudo dnf install MariaDB-server
- 초기 설정 시작
$ sudo mysql-secure-installation
- mariadb 서버 자동으로 시작되도록 설정
$ sudo systemctl enable mariadb
- 리눅스 포트 개방
/etc/my.cnf
에 아래와 같이 3306 포트 추가
#
# This group is read both by the client and the server
# use it for options that affect everything
#
[client-server]
port = 3306
- 방화벽 인바운드 포트 추가
$ sudo firewall-cmd --permanent --add-port=3306/tcp
$ sudo firewall-cmd --reload
- mariadb 서버 설정
/etc/my.cnf.d/server.cnf
# Allow server to accept connections on all interfaces.
#
bind-address=0.0.0.0
- mariadb 서비스 재시작
$ sudo systemctl restart mariadb
- mariadb 루트계정 외부접속 설정
$ mysql -u root -p
MariaDB [(none)]> create user 'root'@'%' identified via mysql_native_password using password ("비밀번호");
MariaDB [(none)]> grant all privileges on *.* to 'root'@'%' with grant option;
MariaDB [(none)]> flush privileges;