ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • MariaDB 설치 (CentOS 7.x)
    Linux 2018. 8. 25. 17:38


    centos 7.x 에 마리아디비 설치하기 



    #>  yum install mariadb-server mariadb-client -y



    ]# yum install mariadb-server mariadb-client -y
     yum install mariadb-server mariadb-client -y yum install mariadb-server mariadb-client -y]# yum install mariadb-server mariadb-client -y

    위와 같이 설치가 완료되면  서버 재시작시에도  자동 시작을 위해 아래와 같이 설정 


    #>systemctl start mariadb.service

    #> systemctl enable mariadb.service




    그럼 이제 보안을 위해 비번 설정 


    mysql -u root
    mysql -u root
    mysql -u root
     mysql -u root 
     mysql -u root  mysql -u root  mysql -u root  mysql -u root  mysql -u root 
    mysql -u root 
    mysql -u root mysql -u root mysql -u root mysql -u root mysql -u root mysql -u root mysql -u root mysql -u root mysql -u root 
    mysql -u root 
    mysql -u root mysql -u root 
     mysql -u root
     mysql -u root mysql -u root mysql -u root mysql -u root mysql -u root mysql -u root mysql -u root mysql -u root
     mysql -u root
     mysql -u root mysql -u root mysql -u root mysql -u root

    #> mysql -u root

    #>  use mysql;

    #> update user SET password =  password('비밀번호') where user = 'root';

    #>  flush privileges;



    로그인 하고 root 비번 바꾸고 실제 접속해보니  비번을 넣으라고 에러 뜨는것 까지 확인 


    이제 testdb 만들고 dhkim 사용자 만들고 권한 부여 작업 


    // db 생성시 아래 옵션처럼줘야 나중에 한글 문제로 고생 안함. 

    CREATE   DATABASE testdb CHARACTER SET = 'utf8'   COLLATE = 'utf8_general_ci';


    ex)dhkim 사용자를 외부에서 접근용으로  만들고  비번을  dhkim123456으로 설정 

    create user 'dhkim'@'%' identified by 'dhkim123456';


    ex) testdb 데이터 베이스에 대해 모든 권한을  dhkim@'%' 에 부여      (여기서 @ 뒤는   localhost 혹은  ip 가 되는데  각각을 권한을 셋팅해줘야 한다. 즉  내가 만약 localhost 에서  디비를 접근하려고한다면   dhkim@localhost 사용자를 만들어서  권한을 부여해야 가능하다. 
    (이 개념땜에 삽질좀 했다.. 아이디가 같은데 엑세스하는 위치에 따라 계정을 만들고 권한도 다르게 부여해야하다니 ...  ㅠㅠ )  

     grant all privileges on testdb.* to 'dhkim'@'%';
     grant all privileges on testdb.* to 'dhkim'@'%';
     grant all privileges on testdb.* to 'dhkim'@'%';
    create user 'dhkim'@'%' identified by 'dhkim123456';
     grant all privileges on testdb.* to 'dhkim'@'%';
     grant all privileges on testdb.* to 'dhkim'@'%'; grant all privileges on testdb.* to 'dhkim'@'%'; grant all privileges on testdb.* to 'dhkim'@'%'; grant all privileges on testdb.* to 'dhkim'@'%'; grant all privileges on testdb.* to 'dhkim'@'%'; grant all privileges on testdb.* to 'dhkim'@'%'; grant all privileges on testdb.* to 'dhkim'@'%';

    grant all privileges on testdb.* to 'dhkim'@'%';





    'Linux' 카테고리의 다른 글

    아파치 , Nginx 에서 remote ip 가 엉뚱하게 나올때  (0) 2019.03.26
    CentOS 7.X MariaDB 분실시  (0) 2018.10.10
    MariaDB 인코딩 이슈  (0) 2018.07.12
    Docker로 gitlab 설치  (0) 2018.05.10
    GoAccess - 아파치 로그 분석  (0) 2018.03.22

    댓글

Designed by Tistory.