설치

  1. 먼저 시스템을 업데이트합니다.

    sudo yum  -y update
  2. Package 로 설치하기 위해 mariadb 저장소 정보를 추가합니다

    sudo tee /etc/yum.repos.d/MariaDB.repo<<EOF 
    
    [mariadb]
    name = MariaDB
    baseurl = http://yum.mariadb.org/10.4/centos7-amd64
    gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
    gpgcheck=1
    EOF
  3. mariadb 저장소를 업데이트합니다.

    sudo yum makecache fast
  4. MariaDB 패키지 설치합니다.

    sudo yum -y install MariaDB-server MariaDB-client
  5. 부팅시 자동으로 구동되도록 설정합니다.

    sudo systemctl enable mariadb
  6. 이제 mariadb 서비스를 시작합니다.

    sudo systemctl restart mariadb

DBMS 설정

  1. 설정 스크립트를 시작합니다.

     sudo mysql_secure_installation
  2. root 암호를 설정합니다.

    NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
          SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
    
    In order to log into MariaDB to secure it, we'll need the current
    password for the root user. If you've just installed MariaDB, and
    haven't set the root password yet, you should just press enter here.
    
    Enter current password for root (enter for none): 
    
    
  3. 권한있는 이만 접속할수 있도록 unix_socket 을 사용하도록 설정합니다.

    Setting the root password or using the unix_socket ensures that nobody
    can log into the MariaDB root user without the proper authorisation.
    
    You already have your root account protected, so you can safely answer 'n'.
    
    Switch to unix_socket authentication [Y/n] 
    
    
  4. 익명 사용자를 삭제합니다.

    By default, a MariaDB installation has an anonymous user, allowing anyone
    to log into MariaDB without having to have a user account created for
    them.  This is intended only for testing, and to make the installation
    go a bit smoother.  You should remove them before moving into a
    production environment.
    
    Remove anonymous users? [Y/n] y
     ... Success!
    
    
  5. root 사용자는 원격에서 접속하지 못하도록 설정합니다.

    Normally, root should only be allowed to connect from 'localhost'.  This
    ensures that someone cannot guess at the root password from the network.
    
    Disallow root login remotely? [Y/n] 
    
    
  6. test 용 DB 를 삭제합니다.

    By default, MariaDB comes with a database named 'test' that anyone can
    access.  This is also intended only for testing, and should be removed
    before moving into a production environment.
    
    Remove test database and access to it? [Y/n] 
    
  7. 변경 사항을 반영하기 위해 privilege 테이블을 다시 로딩하면 설정이 끝납니다.

    Reloading the privilege tables will ensure that all changes made so far
    will take effect immediately.
    
    Reload privilege tables now? [Y/n] 
    
    
  8. 이제 root 사용자로 연결해서 테스트해 보면 됩니다.


같이 보기

Ref





blog comments powered by Disqus