mysql8.0角色管理

创建角色的好处:相当于在用户层面创建了一个视图,可以对用权限进行统一管理。

  • 角色创建

  create role app_readonly;

  • 为角色绑定权限

grant select on *.* to app_readonly;

  •  创建用户

create user app1@localhost identified by '123456';

  • 为用户分配角色

grant app_readonly to app1@localhost;

  •  查看角色

show grants for app1@localhost using app_readonly;

  • 回收权限

revoke app_readonly from app1@localhost;

发布了28 篇原创文章 · 获赞 5 · 访问量 1184

猜你喜欢

转载自blog.csdn.net/weixin_40391011/article/details/103968066