在mysql 5.6命令行客户端(以root用户身份登录)时,我创建了一个用户:
CREATE USER 'admin'@'localhost' IDENTIFIED BY 'password';
然后授予权限:
GRANT ALL PRIVILEGES ON databasename.* TO 'admin'@'localhost';
检查权限时:
SHOW GRANTS FOR 'admin'@'localhost';
上面分配的数据库的权限显示为以下数据:
GRANT USAGE ON *.* TO 'admin'@'localhost' IDENTIFIED BY PASSWORD...
我试图撤销特权:
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'admin'@'localhost';
但它不会删除*.*上的用法
如何撤销对mysql中新用户的*.*的访问权限?
解决方法:
在不删除用户的情况下,您无法实际撤消USAGE. USAGE是全球级特权:
The USAGE privilege specifier stands for “no privileges.” It is used at the global level with GRANT to modify account attributes such as resource limits or SSL characteristics without affecting existing account privileges.
从Privileges Provided by MySQL documentation.
所以基本上如果你想删除USAGE权限,只需使用:
DROP USER 'admin'@'localhost';