db/mysql

특정사용자 table 권한 주기

C/H 2015. 11. 24. 08:30

권한설정

-- 문법
-- GRANT [type of permission] ON [database name].[table name] TO ‘[username]’@'localhost’;
GRANT select ON dbname.tablename TO username;
GRANT update ON dbname.tablename TO username;
GRANT insert ON dbname.tablename TO username;
GRANT delete ON dbname.tablename TO username;
-- GRANT select, insert, update ON test.* TO username@localhost identified by 'password';
flush privileges;


설정해제

-- 설정된 GRANT 설정 보기 
show grants for username;
-- 문법 
-- REVOKE permission ON database.table FROM 'user'@'localhost';
REVOKE INSERT, SELECT ON dbname.tablename FROM 'username';


반응형