Hive之权限
一、库级的权限
-- 授予所有权限给某个用户 grant all on msta to user {userName}; -- 授权admin privilege权限 grant ADMIN PRIVILEGE on database {dbName} to user {userName}; -- 授予某个库的权限给某个用户 grant select on database {dbName} to user {userName}; grant insert on database {dbName} to user {userName}; grant update on database {dbName} to user {userName}; grant delete on database {dbName} to user {userName}; -- 回收某个库的权限给某个用户 revoke select on database {dbName} from user {userName}; revoke insert on database {dbName} from user {userName}; revoke update on database {dbName} from user {userName}; revoke delete on database {dbName} from user {userName}; -- 查看指定用户在所有库下面的权限 show grant user {userName}; -- 查看指定用户在某个库的权限 show grant user {userName} on database {dbName};
二、表级的权限
-- 授予表的权限给某个用户 grant create on database {dbName} to user {userName}; grant select on table {dbName}.tableName to user {userName}; grant insert on table {dbName}.tableName to user {userName}; grant update on table {dbName}.tableName to user {userName}; grant delete on table {dbName}.tableName to user {userName}; -- 回收某个用户的表的权限 revoke create on table {dbName}.tableName from user {userName}; revoke select on table {dbName}.tableName from user {userName}; revoke insert on table {dbName}.tableName from user {userName}; revoke update on table {dbName}.tableName from user {userName}; revoke delete on table {dbName}.tableName from user {userName}; -- 查看指定用户在指定表的权限 show grant user {userName} on table {dbName}.{tableName};
-- 设置session具有Admin权限
set role admin;
ALTER 更改表结构,创建分区
CREATE 创建表
DROP 删除表,或分区
INDEX 创建和删除索引
LOCK 锁定表,保证并发
SELECT 查询表权限
SHOW_DATABASE 查看数据库权限
UPDATE 为表加载本地数据的权限