我正在尝试撤销给定用户的权限,比如mysqluser1
。我以root身份revoke all privileges, grant option for mysqluser1@localhost;
尝试,然后我flush privileges
。当我检查授权时,我发现mysquser1
仍然拥有特权。我究竟做错了什么?
以下是有问题的摘录:
mysql> show grants for mysqluser1@localhost;
+---------------------------------------------------------------------------------------------------------------------+
| Grants for mysqluser1@localhost |
+---------------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'mysqluser1'@'localhost' IDENTIFIED BY PASSWORD '*ALPHANUMSTRINGHERE' |
+---------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql> revoke all privileges, grant option from mysqluser1@localhost;
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> show grants for mysqluser1@localhost;
+---------------------------------------------------------------------------------------------------------------------+
| Grants for mysqluser1@localhost |
+---------------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'mysqluser1'@'localhost' IDENTIFIED BY PASSWORD '*ALPHANUMSTRINGHERE' |
+---------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql>
答案 0 :(得分:2)
@spencer更快,但我也会问,如果你想要摆脱所有特权,那你为什么需要用户?
要完全删除用户帐户,请使用DELETE。从MySQL 4.1.1开始,您还可以使用DROP USER删除用户
答案 1 :(得分:1)
USAGE
权限说明符代表"没有权限。"它在GRANT的全局级别用于修改帐户属性,例如资源限制或SSL特性,而不会影响现有帐户权限。
http://dev.mysql.com/doc/refman/5.5/en/privileges-provided.html