본문 바로가기
개발/react

게시판 만들기(MariaDB 설치하기_리눅스)

by 인스비 2023. 7. 10.
반응형

오랜만에 글을 쓰네요.

기존에 PC에 설치된 MariaDB를 PC속도 이슈로 인하여 삭제하여

놀고 있는 PC의 가상머신으로 리눅스 환경에서 다시 설치하였습니다.

 

설치를 하기 위해서 MariaDB 다운로드 페이지를 들어가서 MariaDB Server Repositories를 클릭하여 들어갔습니다.

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

 

제가 설치한 리눅스는 Rocky Linux 9.2 버전으로 같은 계열인 Red Hat 9 버전을 선택하였고

버전의 경우 10.11 버전을 선택하여 설치를 진행하였습니다.

 

Mirror의 경우 마음에 드는 나라를 선택하시면 됩니다.

저의 경우 가장 가까운 일본을 선택하였습니다.

선택이 마치면 아래와 같이 repo 파일에 들어갈 값이 나옵니다.

 

# MariaDB 10.11 RedHatEnterpriseLinux repository list - created 2023-07-10 04:41 UTC
# https://mariadb.org/download/
[mariadb]
name = MariaDB
# rpm.mariadb.org is a dynamic mirror if your preferred mirror goes offline. See https://mariadb.org/mirrorbits/ for details.
# baseurl = https://rpm.mariadb.org/10.11/rhel/$releasever/$basearch
baseurl = https://tw1.mirror.blendbyte.net/mariadb/yum/10.11/rhel/$releasever/$basearch
# gpgkey = https://rpm.mariadb.org/RPM-GPG-KEY-MariaDB
gpgkey = https://tw1.mirror.blendbyte.net/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck = 1

 

 

이젠 리눅스에 돌아와 아래와 같이 입력 후 insert 버튼을 누른 후 복사한 값을 넣어 줍니다.

vi /etc/yum.repos.d/mariadb.repo

이후 다운로드 페이지에 있는 것과 같이 아래의 명령어를 입력해 주시면 설치가 진행이 됩니다.

sudo dnf install MariaDB-server MariaDB-client

저의 경우 root 계정으로 들어와 있기 때문에 sudo 입력을 제외하고 입력하였습니다.

이후 설치 과정은 RockyLinux 사이트에 있는 MariaDB 설치 가이드를 참고 하여 설치를 진행하였습니다.

https://docs.rockylinux.org/ko/guides/database/database_mariadb-server/

 

MariaDB Database Server - Documentation

database mariadb MariaDB Database Server Prerequisites A Rocky Linux server Proficiency with a command-line editor (we are using vi in this example) A heavy comfort level with issuing commands from the command-line, viewing logs, and other general systems

docs.rockylinux.org

systemctl enable mariadb
systemctl start mariadb

enable 명령을 통해서 부팅 시 서비스가 자동 시작되도록 해줍니다.

이 후 start 명령을 통해 서비스 시작을 해줍니다.

다음으로 다음 명령을 실행해 줍니다

mariadb-secure-installation

만약 하위 버전으로 설치 시에는 mysql_secure_installation 명령을 통해 실행해 주시면 됩니다.

이후 mysql -p 명령을 통해 MariaDB에 접속이 가능합니다.

mysql -p

이 후 기존과 같이 DB 세팅을 하였습니다.

728x90

댓글