DBMS

[DBMS] 4. MariaDB 설치

katia 2023. 3. 23. 13:53

설치

Windows

  1. MariaDB 공식 홈페이지에 접속하여 설치 파일을 다운로드 받는다. (여기서는 zip파일 활용)

  2. 다운로드 받은 압축 파일을 DBMS 설치 희망 경로에 압축 해제한다. (여기서는 C:\230227dbms\)

  3. 명령 프롬프트(터미널 혹은 PowerShell 등)을 실행하여 아래 절차를 따른다.

  4. DBMS 설치 디렉토리 내 bin 디렉토리로 이동하기 위해 아래와 같이 명령한다.

     cd C:\230227dbms\bin\
  5. DBMS 설치를 위해 아래와 같이 명령한다.

     .\mysql_install_db.exe --service="MariaDB 230227" --port=33063 --password="test1234"
    • --service: MariaDB DBMS 서비스 등록 이름을 지정한다. 식별하기 편한 이름으로 지정하면 된다. 여기서는 MariaDB 230227

    • --port: MariaDB DBMS 포트 번호이다. 생략시 기본 값으로 3306을 사용한다. 여기서는 33063

    • --password: root 계정(최고 관리자 계정)의 비밀번호를 지정한다. 여기서는 test1234

      Default data directory is C:\230227dbms\data
      Running bootstrap
      Registering service 'MariaDB 230227'
      Creating my.ini file
      Removing default user
      Setting root password
      Creation of the database was successful
    • 매개 변수 등을 정상 입력한 후 실행하면 최종적으로 Creation of the database was succesful 이라는 메세지를 출력하며 종료된다.

  6. 서비스 관리자(services.msc)를 실행하여 <5>에서 정한 서비스(MariaDB 230227)가 정상 등록되었는지 확인한다.

  7. 기본 인코딩 설정을 UTF-8로 지정하기 위해 아래와 같이 명령한다.

     notepad "C:\230227dbms\data\my.ini"
  8. <7>에서 열린 메모장의 내용을 아래와 일치할 수 있도록 변경한다.

     [client]
     default-character-set=utf8mb4
    
     [mysql]
     default-character-set=utf8mb4
    
     [mysqld]
     character-set-server=utf8mb4
     collation-server=utf8mb4_unicode_520_ci
     init-connect='SET NAMES utf8mb4'
     port=33063
  9. <8>에서 편집한 내용을 반드시 저장하고 <6>에서 실행한 서비스 관리자의 MariaDB 230227 항목을 더블 클릭하여 시작버튼을 클릭, MariaDB DBMS 서비스를 시작시킨다.

  10. MariaDB CLI Client 프로그램을 활용하여 접속이 정상적으로 이루어지는지 확인한다.

    C:\230227dbms\bin\mysql.exe -u root -p -P 33063
    • -u root : 접속 계정으로 root를 활용하겠다는 의미.
    • -p : 비밀번호를 통해 접속하겠다는 의미. (소문자 p)
      • 비밀번호는 <5>--password의 매개변수 값으로 전달한 값이다. (여기서는 test1234)
    • -P 33063 : 33063 포트를 통해 접속하겠다는 의미. (대문자 P)
    • 아래와 같이 커맨트 라인이 MariaDB [(none)]>로 변경되면 정상 접속된 것이다.
    Enter password: ********
    Welcome to the MariaDB monitor.  Commands end with ; or \g.
    Your MariaDB connection id is 3
    Server version: 10.11.2-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)]>
    • 위 상태에서 exit 입력시 Bye 메세지 출력 후 MariaDB CLI Client 프로그램을 종료한다.
  11. 컴퓨터 자원 관리를 위해 MariaDB DBMS 사용을 원치 않을 때 <6>에서 실행한 서비스 관리자에서 MariaDB DBMS 서비스를 중단시킬 수 있다.

Mac

  1. Homebrew 설치를 위해 Homebrew 공식 사이트로 이동한다.

  2. 터미널을 실행한 후 <1>에 있는 설치 명령을 복사하여 붙여넣는다.

     user@host ~ % /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    • 혹시 아래와 같은 메세지가 떠있으면 엔터키를 한 번만 누른다.

      Press RETURN to continue or any other key to abort
    • 설치가 완료되면 아래와 같은 메세지가 뜬다.

      ==> Next steps:
      Run these two commands in your terminal to add Homebrew to your PATH:
      (echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/???/.zprofile
      eval "$(/opt/homebrew/bin/brew shellenv)"
      Run brew help to get started
      Further documentation:
      https://docs.brew.sh
    • 위 메세지에서 Run these two commands in your terminal... 아래의 (echo;...로 시작하는 줄과 eval "$...로 시작하는 두 줄을 복사하여 붙여넣는다.

      (echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/???/.zprofile
      eval "$(/opt/homebrew/bin/brew shellenv)"
    • 위 명령은 사용자 마다 다르게 나오는 부분이 있음으로 반드시 본인의 터미널에 출력된 내용을 입력해야 한다.

    • brew가 정상 설치 되었는지 확인하기 위해 아래와 같이 명령한다.

      user@host ~ % which brew

      실행 결과로 아래와 같이 출력되는지 확인한다.

      /opt/homebrew/bin/brew
  3. <2>에서 Homebrew 설치가 완료되었으면 이를 통해 아래와 같이 MariaDB를 설치한다.

     brew install mariadb
  4. MariaDB DBMS 설치가 완료되었으면 아래와 같이 명령하여 서비스를 시작한다.

     user@host ~ % brew services start mariadb
  5. <4>에서 서비스가 정상적으로 시작되었다면 아래와 같이 명령하여 정상 접속되는지 확인한다.

     user@host ~ % sudo mysql -u root
    • 아래와 같이 명령줄이 변하면 접속이 정상적으로 수행된 것이다.

      Welcome to the MariaDB monitor.  Commands end with ; or \g.
      Your MariaDB connection id is 3
      Server version: 10.11.2-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)]>

Ubuntu Linux

  1. Ubuntu Linux 에서 MariaDB DBMS를 설치하기 위해 아래와 같이 명령한다.

     sudo apt install mariadb-server -y
  2. 다음과 같이 명령하여 정상 접속되는지 확인한다.

     sudo mysql -u root

'DBMS' 카테고리의 다른 글

[DBMS] 6. 사용자 및 권한  (0) 2023.03.23
[DBMS] 5. 개념  (0) 2023.03.23
[DBMS] 3. 데이터베이스(Database) - part 2  (0) 2023.03.07
[DBMS] 2. 데이터 베이스(Database) - Part 1  (0) 2023.03.06
[DBMS] 1. 데이터(Data)  (0) 2023.03.06