<권한 생성>
grant all privileges on 디비명.테이블명 to 사용자@'접속지 주소' identified by '암호' (with grant option);
'with grant option'는 grant 명령을 사용할 수 있는 권한까지 부여하는 것으로 보통 사용할 필요 없음.

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

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

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

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