【问题标题】:can't copy user or role privileges in MySql 8.0无法在 MySql 8.0 中复制用户或角色权限
【发布时间】:2019-05-10 14:56:23
【问题描述】:

我已经在 PhpMyAdmin 和 DataGrip 中尝试过这个查询:

drop user god_user, god;
create user god_user identified by 'god', god identified by 'god';
grant all on *.* to god with grant option ;
grant god to god_user;

show grants for god_user

似乎一切正常,show grants for god_user 显示如下:

GRANT USAGE ON *.* TO `god_user`@`%`
GRANT `god`@`%` TO `god_user`@`%`

使用 PhpMyAdmin,我可以以 god 登录,然后看到 ALL PRIVILEGES 的标志 GRANT 设置为 YES。但是god_user 呢,它表明god_user 没有权限。为什么?如果我以god_user 身份登录PhpMyAdmin,我什至看不到我的数据库列表!

这是一个错误吗?我grant all on *.* to god_user with grant option就可以了。

flush privileges 没有给我任何新东西。另外,如果godrole,而不是user(我认为没有太大区别)。我是root。

【问题讨论】:

  • 将一个用户的权限授予另一个用户时,不需要使用Proxy关键字吗?
  • @HoneyboyWilson,我只需要激活我的角色)

标签: mysql database sql-grant


【解决方案1】:

问题非常愚蠢:我忘了激活我的角色。 以下代码解决了我的问题。 (它将所有授予的角色激活给指定的用户。)

set default role all to god_user, admin;

就是这样)

文档中有关于“激活角色”的段落,但我跳过了...

【讨论】:

    猜你喜欢
    • 2019-04-04
    • 2014-02-03
    • 2015-11-26
    • 2018-11-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-15
    相关资源
    最近更新 更多