티스토리 뷰

root 계정으로 로그인 한 후 다음의 작업을 수행 할 수 있다.

$ mysql -uroot -p

 

사용자 생성

$ create user 'username'@'localhost' identified by 'password';

 

사용자 권한 부여

- 사용자에게 모든 권한을 부여

$ grant all privileges on *.* to 'username'@'localhost';

 

- 사용자에게 특정 DB에 대한 모든 권한을 부여

$ grant all privileges on dbname.* to 'username'@'localhost';

 

- 사용자에게 특정 DB의 특정 테이블에 대한 모든 권한 부여

$ grant all privileges on dbname.tablename to 'username'@'localhost';

 

+) 사용자에게 특정한 권한만을 부여 할 수도 있다.

$ grant delete, insert, select on dbname.* to 'username'@'localhost' identified by 'password';

 

 

사용자에게 주어진 권한 확인

$ show grants for 'username'@'localhost';

 

사용자 권한 삭제

- 사용자에게 주어진 권한 삭제

$ revoke all privileges on dbname.tablename from 'username';

 

+) 모든 IP를 특정하지 않기 위해서는 'localhost' 대신 '%'를 사용한다.

$ create user 'username'@'%' identified by 'password';

 

사용자 삭제

$ drop user 'username'@'localhost';

공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/02   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28
글 보관함