gpt4 book ai didi

mysql - 撤销所有特权,授予选项不起作用?

转载 作者:行者123 更新时间:2023-11-29 05:22:10 25 4
gpt4 key购买 nike

我正在尝试撤销给定用户的权限,比如 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>

最佳答案

@spencer 更快,但我也想问,如果你想摆脱所有特权,那你为什么需要用户?

要完全删除用户帐户,请使用 DELETE。从 MySQL 4.1.1 开始,您还可以使用 DROP USER 删除用户

关于mysql - 撤销所有特权,授予选项不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24336225/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com