The GRANT command is used to grant the specified user or role specified permissions
privilege_list is a list of privileges to be granted, separated by commas. Currently Doris supports the following permissions:
ADMIN_PRIV: All privileges except NODE_PRIV.
GRANT_PRIV: Privilege for operation privileges. Including creating and deleting users, roles, authorization and revocation, setting passwords, etc.
SELECT_PRIV: read permission on the specified database or table
LOAD_PRIV: Import privileges on the specified database or table
ALTER_PRIV: Schema change permission for the specified database or table
CREATE_PRIV: Create permission on the specified database or table
USAGE_PRIV: access to the specified resource
ALL and READ_WRITE in legacy permissions will be converted to: SELECT_PRIV,LOAD_PRIV,ALTER_PRIV,CREATE_PRIV,DROP_PRIV;
READ_ONLY is converted to SELECT_PRIV.
Permission classification:
1. Node Privilege: NODE_PRIV
2. database table permissions: SELECT_PRIV, LOAD_PRIV, ALTER_PRIV, CREATE_PRIV, DROP_PRIV
3. Resource permission: USAGE_PRIV
1. *.*.* permissions can be applied to all catalogs, all databases and all tables in them
2. ctl.*.* permissions can be applied to all databases and all tables in them
3. ctl.db.* permissions can be applied to all tables under the specified database
resource_name supports the following two forms:
user_identity:
The user_identity syntax here is the same as CREATE USER. And must be a user_identity created with CREATE USER. The host in user_identity can be a domain name. If it is a domain name, the effective time of the authority may be delayed by about 1 minute.
You can also assign permissions to the specified ROLE, if the specified ROLE does not exist, it will be created automatically.
Grant permissions to all catalog and databases and tables to the user
GRANT SELECT_PRIV ON *.*.* TO 'jack'@'%';
-
GRANT SELECT_PRIV,ALTER_PRIV,LOAD_PRIV ON ctl1.db1.tbl1 TO 'jack'@'192.8.%';
Grant permissions to the specified database table to the role
Grant access to all resources to users
GRANT USAGE_PRIV ON RESOURCE * TO 'jack'@'%';
Grant the user permission to use the specified resource