Close

[MariaDB] 우분투 워드프레스 신규 사이트를 위한 DB 추가하기

NGINX기반으로 워드프레스를 운용하고 있다. 때때로 새로운 사이트를 추가할 경우가 있는데, 새로운 사이트를 위한 홈 디렉토리를 만들고, Nginx Default파일을 통해 라우팅을 해주었다면, 다음은 새 사이트를 위한 데이터베이스를 추가해야 한다. 이번 가이드는 우분투와 MariaDB환경을 상정하고 진행해 보겠다.

mariadb -u root -p
Plaintext
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 5740
Server version: 10.3.38-MariaDB-0ubuntu0.20.04.1 Ubuntu 20.04

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)]>

Plaintext

첫 코드는 root 계정으로 mariadb에 로그인을 시도하는 코드다. 명령어를 입력하면 Enter Password줄이 표시되는데, MariaDB 설치 시 설정한 비밀번호를 입력하면 된다. MariaDB에 성공적으로 로그인된 경우, 두번째 코드 스니펫과 같이 터미널에 입력창이 표시된다.

MariaDB [(none)]> create database 데이터베이스이름(영문으로);
Plaintext
MariaDB [(none)]> exit;
Plaintext

MariaDB 콘솔에 로그인한 후에는 create database 명령어를 통해 새로운 DB를 생성할 수 있다. DB의 제목은 대소문자가 구분되는 case-sensitive이기 때문에, 주의가 요구된다. (리눅스 환경에서 Note_DB, note_DB, note_DB는 모두 다르게 인식된다)

여기까지 정상적으로 진행되었다면, 워드프레스 셋업 화면에서 설정한 데이터베이스 이름을 Database Name란에 정확히 입력해주면 된다.