无法在 MySql 8.0 中复制用户或角色权限
can't copy user or role privileges in MySql 8.0
我在 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,我什至看不到我的 DB 列表!
这是一个错误吗?如果我 grant all on *.* to god_user with grant option
.
就可以了
flush privileges
没有给我任何新东西。另外,如果 god
是 role
,而不是 user
(我认为没有太大区别)。我是root。
问题是ultra-dumb:我忘了激活我的角色。
以下代码解决了我的问题。 (它激活指定用户的所有授予角色。)
set default role all to god_user, admin;
就是这样)
关于 'activating roles' 的段落在文档中,但我跳过了它...
我在 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,我什至看不到我的 DB 列表!
这是一个错误吗?如果我 grant all on *.* to god_user with grant option
.
flush privileges
没有给我任何新东西。另外,如果 god
是 role
,而不是 user
(我认为没有太大区别)。我是root。
问题是ultra-dumb:我忘了激活我的角色。 以下代码解决了我的问题。 (它激活指定用户的所有授予角色。)
set default role all to god_user, admin;
就是这样)
关于 'activating roles' 的段落在文档中,但我跳过了它...