授權
GRANT priv_type [(column_list)] [, priv_type [(column_list)] …]
ON {tbl_name | * | *.* | db_name.*}
TO user_name [IDENTIFIED BY [PASSWORD] 'password']
[, user_name [IDENTIFIED BY 'password'] …]
[REQUIRE
NONE |
[{SSL | X509}]
[CIPHER cipher [AND]]
[ISSUER issuer [AND]]
[SUBJECT subject]]
[WITH [GRANT OPTION | MAX_QUERIES_PER_HOUR # |
MAX_UPDATES_PER_HOUR # |
MAX_CONNECTIONS_PER_HOUR #]]
註解
WITH GRANT OPTION 是特殊的權限,它可以讓會員給自己擁有的權限到其他的會員
WITH 可以限制會員在一個小時內所允許的查詢,更新,或連線數量。預設值是 0,代表沒有限制。
REQUIRE 可以限制會員必須用安全的連線登入。
實作
GRANT USAGE
ON *
TO luke@localhost IDENTIFIED BY '123456';
刪除授權
REVOKE priv_type [(column_list)] [, priv_type [(column_list)] …]
ON {tbl_name | * | *.* | db_name.*}
FROM user_name [, user_name …]
實作
REVOKE ALL ON employee.* FROM luke;
留言