MySQL 授权,回收权限,查看权限

Posted anxbb

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MySQL 授权,回收权限,查看权限相关的知识,希望对你有一定的参考价值。

show GRANTS for [email protected];
flush privileges;
SHOW PROCESSLIST;

#全局授权,回收权限
GRANT ALL ON *.* TO ‘testzzq‘@‘localhost‘;
REVOKE ALL ON *.* FROM ‘testzzq‘@‘localhost‘;
flush privileges;

#数据库级别,授权,回收权限
GRANT ALL PRIVILEGES ON cs TO ‘testzzq‘@‘localhost‘;
REVOKE ALL PRIVILEGES ON cs FROM ‘testzzq‘@‘localhost‘;
flush privileges;

#数据库表级别,授权,回收权限
GRANT ALL PRIVILEGES ON cs.apply_reduction TO ‘testzzq‘@‘localhost‘ WITH MAX_QUERIES_PER_HOUR 2;
REVOKE ALL PRIVILEGES ON cs.apply_reduction FROM ‘testzzq‘@‘localhost‘;
flush privileges;


授权公式:
GRANT
priv_type [(column_list)]
[, priv_type [(column_list)]] ...
ON [object_type] priv_level
TO user [auth_option] [, user [auth_option]] ...
[REQUIRE {NONE | tls_option [[AND] tls_option] ...}]
[WITH {GRANT OPTION | resource_option} ...]

resource_option: {
| MAX_QUERIES_PER_HOUR count
| MAX_UPDATES_PER_HOUR count
| MAX_CONNECTIONS_PER_HOUR count
| MAX_USER_CONNECTIONS count
}

The number of queries an account can issue per hour
一个账号每小时可以发起查询操作的个数
The number of updates an account can issue per hour
一个账号每小时可以发起更新操作的个数
The number of times an account can connect to the server per hour
一个账号每小时可以连接服务器的次数
The number of simultaneous connections to the server by an account
一个账号同时可以连接服务器的个数,


#查看权限

show GRANTS for ‘testzzq‘@‘localhost‘

 

































以上是关于MySQL 授权,回收权限,查看权限的主要内容,如果未能解决你的问题,请参考以下文章

如何给mysql用户分配权限

mysql——权限管理——授权收回权限查看授权

第三篇:MySQL授权认证

MySQL—— 用户创建和权限管理

MySQL的权限都有哪些

MySQL