我在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,我甚至看不到我的数据库列表!
那是个bug吗?如果我grant all on *.* to god_user with grant option就可以了。
flush privileges没有给我任何新的东西。另外,如果god是一个role,而不是user (我认为这没有太大区别)。我是根。
发布于 2019-05-12 04:53:43
问题非常愚蠢:我忘了激活我的角色。下面的代码修复了我的问题。(它激活所有授予指定用户的角色。)
set default role all to god_user, admin;就是这样)
文档中有关于“激活角色”的段落,但我跳过了……
https://stackoverflow.com/questions/56080142
复制相似问题