MySQL資料庫grant授權命令
阿新 • • 發佈:2018-11-12
MySQL資料庫grant授權命令
製作人:全心全意
grant授權命令的使用
grant授權命令使用語法:
grant 許可權 on 資料庫物件 to 使用者
許可權:
select:檢視資料庫表資料許可權
insert:插入資料庫表資料許可權
update:修改資料庫表資料許可權
delete:刪除資料庫表資料許可權
create:建立資料庫表許可權
alter:修改資料庫表屬性許可權
drop:刪除資料庫表許可權
references:操作資料庫表外來鍵許可權
create temporary:操作MySQL資料庫臨時表許可權
index:操作MySQL索引許可權
create view:操作MySQL檢視許可權
show view:檢視MySQL檢視屬性許可權
create routine:
alter routine:
execute:
all privileges:普通DBA管理員許可權
all:高階DBA管理員許可權
檢視MySQL使用者許可權
檢視當前使用者(自己)許可權:
show grants;
檢視其他 MySQL 使用者許可權:
show grants for[email protected];
revoke撤權命令的使用
revoke撤權命令的使用語法:
revoke 許可權 on 資料庫物件 from 使用者;
授權、撤權的注意事項
1. grant, revoke 使用者許可權後,該使用者只有重新連線 MySQL 資料庫,許可權才能生效。
2. 如果想讓授權的使用者,也可以將這些許可權 grant 給其他使用者,需要選項 “grant option“
grant 許可權 on 資料庫物件 to 使用者 with grant option;
這個特性一般用不到。實際中,資料庫許可權最好由 DBA 來統一管理。