创建一个角色,把对改组表的查询和修改权限给角色,然后给用户赋角色即可
create role rolename identified by psword;
grant select,update on tbname1 to rolename;
......
grant rolename to username;
create role rolename identified by psword;
grant select,update on tbname1 to rolename;
......
grant rolename to username;
表t1,t2
首先以管理员的权限登录,并对表的用户拥有着授权
connect system/manager
grant create role to user;然后登录到拥有表的用户下:
connect user/password建立角色:
create role rol_tab;对角色授权:
grant select,update on t1 to rol_tab;
grant select,update on t2 to rol_tab;对用户授予角色权限:
grant rol_tab to user1;
grant rol_tab to user2;此时用户user1要查询user下的表t1,需要这样:
select * from user.t1;
即表名前有用户名前缀。