MySQL权限回收

1.查看系统用户
mysql> select user,host from mysql.user;
+---------------+-----------+
| user | host |
+---------------+-----------+
| root | 10.0.0.% |
| wish | 10.0.0.% |
| wish01 | 10.0.0.% |
| wish02 | 10.0.0.% |
| mysql.session | localhost |
| mysql.sys | localhost |
| root | localhost |
+---------------+-----------+
7 rows in set (0.00 sec)

2.查看用户权限
查看wish02用户的权限
mysql> show grants for wish02@'10.0.0.%';
+--------------------------------------------------------------------------------------+
| Grants for wish02@10.0.0.% |
+--------------------------------------------------------------------------------------+
| GRANT SELECT, INSERT, UPDATE, DELETE ON . TO 'wish02'@'10.0.0.%' WITH GRANT OPTION |
+--------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

3.回收权限
回收wish02用户delete权限
mysql> revoke delete on . from 'wish02'@'10.0.0.%';
Query OK, 0 rows affected (0.00 sec)

再次查看wish02用户的权限,可以看到delete权限被回收了
mysql> show grants for wish02@'10.0.0.%';
+------------------------------------------------------------------------------+
| Grants for wish02@10.0.0.% |
+------------------------------------------------------------------------------+
| GRANT SELECT, INSERT, UPDATE ON . TO 'wish02'@'10.0.0.%' WITH GRANT OPTION |
+------------------------------------------------------------------------------+
1 row in set (0.00 sec)

posted @ 2021-12-19 15:33  老天啊  阅读(522)  评论(0编辑  收藏  举报