create user admin identified by 'password'; 创建用户

user支持以下书写方式:

1.任意主机:user@'%'

2.本机:user@'localhost'

3.网段:user@'192.168.0.0'

4.ip地址:user@'192.168.10.6'

5.不写主机与user@'%'等价

grant select on db1.t1 to use1; 为用户赋权

revoke select on db1.t1 from use1; 收回用户权限

show grants for user; 查看用户权限

grant usage on . to username with task_priority priority_value 为用户赋予优先级权限

注:priority_value的取值范围是0~3,数字越大优先级越高,缺省为0。

示例:

创建数据库用户admin,赋予t.a列查询权限并登录

create user use1 identified by '123456';

grant select(a) on test.t to admin;

flush privileges;

\q

gccli -uadmin -p123456

use test;

select * from t; ERROR

select a from t; 查询成功


GBase数据库
1 声望2 粉丝

GBase数据库知识分享