我已经在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
没有特权。为什么?而且,如果我登录phpmyadmin作为god_user
,我什至看不到我的DBS列表!
那是一个错误吗?如果我 grant all on *.* to god_user with grant option
。
flush privileges
没有给我什么。另外,如果god
是role
,而不是user
(我认为没有很大的区别(。我是根。
问题是超愚蠢:我忘了激活我的角色。以下代码解决了我的问题。(它激活所有授予指定用户的角色。(
set default role all to god_user, admin;
就是这样(
有关"激活角色"的段落是在文档中,但我跳过了...