1.查询集群信息
select * from system.clusters c
2.创建角色(RBAC)
create role dbatest01 ON CLUSTER cluster_2_shard_2_replicas
3.查询角色
SELECT *from `system`.roles
4.授权dataview库权限给角色 dbatest01
-- dbatest01 授权dataview 库全部权限
grant all on dataview.* to dbatest01 on cluster cluster_2_shard_2_replicas
-- dbatest02 授权dataview 库查询权限
grant SELECT,SHOW on dataview.* to dbatest01 on cluster cluster_2_shard_2_replicas
all 是授权所有权限
5.查看角色权限
SELECT *from `system`.grants where role_name='dbatest01'
6.创建用户
create user 'roleuser' identified by '123456' on cluster cluster_2_shard_2_replicas
7.查询用户
SELECT * from `system`.users
8.授予用户角色权限
grant dbatest01 to axauser on cluster cluster_2_shard_2_replicas
9.查看用户角色
SELECT *from system.role_grants
10.删除用户和角色
删除用户:DROP USER IF EXISTS cicc on cluster cluster_2_shard_2_replicas;
删除角色
DROP ROLE IF EXISTS role1 on cluster cluster_2_shard_2_replicas;
取消角色的权限
REVOKE insert on default.* FROM role2 on cluster cluster_2_shard_2_replicas;
取消用户的角色REVOKE ON CLUSTER cluster_2_shard_2_replicas role2 from cicc2;