mysql

mysql 접근 권한 설정

초이짬 2013. 9. 8. 00:38
728x90

출처가 명확하지 않아서 원글 주인에겐 죄송합니다.

문제시 삭제합니다.

 

 

 

<권한설정>
grant all privileges on 디비명.테이블명 to 사용자@'접속지 주소' identified by '암호' (with grant option);

grant all privileges on *.* to  root@'%' identified by '암호with grant option;
grant all privileges on *.* to  root@'localhost' identified by '암호with grant option;

<권한 제거>
revoke all on 디비명.테이블명 from 사용자;

<권한 적용>
# 모든 명령 후에 항상 아래 명령을 실행해야 실제로 적용된다. 
flush privileges; 



<기타>
# '사용자'가 '암호'으로  localhost 에서 db1 디비의 table1에 접속하도록 허용
grant all privileges on root.db1 to 사용자@'localhost' identified by '암호';

# '사용자'가 '암호'으로 111.222.333.444 에서 db1 디비의 모든 테이블에 접속하도록 허용
grant all privileges on root.* to 사용자@'111.222.333.444' identified by '암호';

# '사용자'가 '암호'으로 111.222.333.0/24 에서 모든 디비와 테이블에 접속하도록 허용
grant all privileges on *.* to  사용자 @'111.222.333.%' identified by '암호';
728x90