[DB] Maria DB 설치 방법

 

◼ MariaDB 설치
 1. 본 설치과정은 MariaDB 10.9.3 버전을 압축파일(zip)로 설치하는 과정에 대한 설명이다. 버전이 다르거나 파일타입(msi라던가) 이 다른 경우 그 과정이 달라질 수 있음
 2. 다운로드는 MariaDB 재단 사이트(https://mariadb.org/) 에서 가능하다.

 

3. 다운로드 받은 압축파일을 아래 요건에 맞는 위치에 압축해제한다.

   a. 본인이 기억할 수 있는 위치여야함
   b. 앞으로 이동하거나 삭제하지 않을 위치여야함
   c. 경로상에 영문 및 숫자, 공백을 제외한 다른 문자가 들어가지 않아야함
   d. 본 예제에서는 그 경로를 c:\202208250900dbms\  로 가정한다.
   e. 위 경로로 이동하면 아래와 같이 구성요소가 나열되어있으면 된다. 나열되어있지 않은 기타 파일은 없어도 상관없음.
        - [디렉토리] `bin`
        - [디렉토리] `include`
        - [디렉토리] `lib`
        - [디렉토리] `share`
 
 4. 명령프롬프트(cmd)를 실행한다. ( win +R 입력창에 cmd입력후 확인)
  5. 아래 명령을 입력하여 MariaDB의 압축을 해제한 경로로 이동한다.
cd C:\202208250900dbms\
                 ↑ 공백
C:\202208250900dbms>
 
6.MairaDB 설치를 위해 경로 내 bin 디렉토리로 이동하기 위해 아래명령을 입력한다.
 C:\202208250900dbms>cd bin
             ↑ 공백
C:\202208250900dbms\bin>
 
7. MariaDB 초기화 및 설치를 위해 아래 명령을 입력한다.
 
 C:\202208250900dbms\bin>mysql_install_db.exe --service="MariaDB 2208250900" --port=12602 --password=test1234
    ↑ 공백                      ↑ 공백            ↑ 공백

Default data directory is C:\202208250900dbms\data
Running bootstrap
Registering service 'MariaDB 2208250900'
Creating my.ini file
2022-09-26 12:30:19 0 [Note] C:\202208250900dbms\bin\mysqld.exe (server 10.9.3-MariaDB) starting as process 6972 ...
Removing default user
Setting root password
Creation of the database was successful

C:\202208250900dbms\bin>

 

◼ MariaDB 서비스 관리

 ▫ 서비스 관리를 위해 아래 명령어를 실행(win+R)에 입력한다.
services.msc

 ▫ 위  MariaDB 설치과정중에 입력한 --services 항목값과 일치하는 서비스를 찾은 뒤 더블클릭하면 아래 요소를 확인 및 실행할 수있다.
▪서비스 상태
▪서비스 시작
▪서비스 중지

// DB가 리소스를 많이 잡아먹어서 노트북에 파일이 많을땐 그냥 시작유형을 수동으로 바꿔주는게 훨씬 좋다
◼ MairaDB인코딩 설정
 ▫ MairaDB 최초 설치시 인코딩이 UTF-8로 설정되어있지 않음으로 명령프롬프트에서 아래와 같이 명령한다.
 ?> cd C:\202208250900dbms\data\
 C:202208250900dbms\data> notepad my.ini
 메모장 내용을 아래와 같이 변경
[mysqld]
datadir=C:/202208250900dbms/data
port=12602
character-set-server=utf8
[mysql]
default-character-set=utf8

[client]
port=12602
plugin-dir=C:\202208250900dbms/lib/plugin
default-character-set=utf8

>> 메모장 저장 후 win+R >>services.msc>>MairaDB 중지 후 실행 (* 메세지 뜨면 메모장 오류)

메모장 변경 내용 저장 후 서비스에서 MariaDB 22080900 항목 재시작
C:\202208250900dbms\data>cd ..\bin
C:\202208250900dbms\bin>mysql.exe -u root -p -P 12602
Enter password: ********
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.9.3-MariaDB mariadb.org binary distribution

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 VARIABLES LIKE '%char%';
+--------------------------+-------------------------------------+
| Variable_name            | Value                               |
+--------------------------+-------------------------------------+
| character_set_client     | utf8mb3                             |
| character_set_connection | utf8mb3                             |
| character_set_database   | utf8mb3                             |
| character_set_filesystem | binary                              |
| character_set_results    | utf8mb3                             |
| character_set_server     | utf8mb3                             |
| character_set_system     | utf8mb3                             |
| character_sets_dir       | C:\202208250900dbms\share\charsets\ |
+--------------------------+-------------------------------------+
8 rows in set (0.002 sec)

MariaDB [(none)]>


◼ MariaDB 최초접속
 ▫명령 프롬프트에서 아래 명령어를 입력하여 MariaDB 클라이언트가 있는 위치로 이동한다.lllllllllkiolk22111111
 ?>cd C:\202208250900dbms\bin\

C:\202208250900dbms\bin>

8. MariaDB에 접속하기 위해 아래와 같이 명령한다. 최종적으로 MariaDB [(none)] 으로 명령줄이 변경되었으면 성공.
mysql.exe -u root -p -P 12602


C:\202208250900dbms\bin>mysql.exe -u root -p -P 12602
Enter password: ********
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.9.3-MariaDB mariadb.org binary distribution

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


9.MariaDB 클라이언트에서 빠져나오기 위해 아래와 같이 명령한다.

MariaDB [(none)]>exit
Bye
C:\202208250900dbms\bin>