MySQL 权限与用户表

时间:2021-05-25 04:53:50

1.授权时创建用户

grant all privileges on *.* to zhengwenqiang@localhost identified by 'zhengwenqiang';

2.收回insert权限

revoke insert on *.* from zhengwenqiang@lolcalhost;

3.remainder privileges

show grants for zhengwenqiang@localhost \G;

4. Grant Rule : 授权最小的、满足用户需求的权限。

root@localhost :: ->select * from mysql.user where User='zhengwenqiang' \G;
*************************** . row ***************************
Host: localhost
User: zhengwenqiang
Password: *BCD85D1E5C75845943DFDCE3DEB7EB9EE6C37ED0
Select_priv: Y
Insert_priv: N
Update_priv: Y
Delete_priv: Y
Create_priv: Y
Drop_priv: Y
Reload_priv: Y
Shutdown_priv: Y
Process_priv: Y
File_priv: Y
Grant_priv: N
References_priv: Y
Index_priv: Y
Alter_priv: Y
Show_db_priv: Y
Super_priv: Y
Create_tmp_table_priv: Y
Lock_tables_priv: Y
Execute_priv: Y
Repl_slave_priv: Y
Repl_client_priv: Y
Create_view_priv: Y
Show_view_priv: Y
Create_routine_priv: Y
Alter_routine_priv: Y
Create_user_priv: Y
Event_priv: Y
Trigger_priv: Y
Create_tablespace_priv: Y
ssl_type:
ssl_cipher:
x509_issuer:
x509_subject:
max_questions:
max_updates:
max_connections:
max_user_connections:
plugin:
authentication_string: NULL
row in set (0.00 sec) ERROR:
No query specified

权限管理使用唯一的入口、收回alter权限。