운영체제_OS/리눅스_Linux

Rocky Linux 9 에서 MariaDB 설치 방법

초로 2022. 10. 4. 14:48

Rocky Linux 9 에서 MariaDB 설치 방법

 

 

MariaDB 설치

설치

sudo dnf install mariadb-server mariadb -y

 

재부팅시 시작

sudo systemctl enable --now mariadb

 

설치 버전 확인

mysql -V

 

MariaDB 기본 설정

# sudo mysql_secure_installation

Enter current password for root (enter for none): [패스워드가 없기 때문에 엔터]
◇ 이 부분은 버전에 따라 안 나올 수 있습니다.
Switch to unix_socket authentication [Y/n] Y    [MariaDB 실행 시 통신 소켓 생성 여부? Y 엔터]
Change the root password? [Y/n] Y   [DB ROOT 패스워드 설정할 것인가? Y 엔터]
New password:  패스워드 입력
Re-enter new password:  재확인 패스워드 입력
Remove anonymous users? [Y/n] Y  [익명의 접근을 막을 것인지? 보안을 위해 Y 엔터]
Disallow root login remotely? [Y/n] Y  [DB ROOT 원격을 막을 것인지? 보안을 위해 Y 엔터]
Remove test database and access to it? [Y/n] Y [Test 용으로 생성된 데이터베이스를 삭제할 것인가? Y 엔터]
Reload privilege tables now? [Y/n] Y [현재 설정한 값을 적용할 것인지? 당연히 Y 엔터]
Thanks for using MariaDB! [설정 완료]

 

WordPress 를 위한 MariaDB 설정 방법

# sudo mysql -u root

CREATE DATABASE wordpressdb;
CREATE USER 'wordpressuser'@'localhost' identified by 'StrongPassword';
GRANT ALL PRIVILEGES ON wordpressdb.* TO 'wordpressuser'@'localhost';
FLUSH PRIVILEGES;
QUIT;

 

생성한 DB 확인

# mysql -u wordpressdb -p

Enter password: [만든 암호 입력]

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 17
Server version: 10.5.16-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
wordpressdb        |
+--------------------+
2 rows in set (0.000 sec)

MariaDB [(none)]>