Help Center/ MapReduce Service/ Troubleshooting/ Using Hive/ A Newly Created User Has No Query Permissions
Updated on 2022-09-14 GMT+08:00

A Newly Created User Has No Query Permissions

Symptom

When a user is created, an error message is displayed indicating that the user does not have permissions to query data.

Error: Error while compiling statement: FAILED: HiveAccessControlException Permission denied: Principal [name=hive, type=USER] does not have following privileges for operation QUERY [[SELECT] on Object [type=TABLE_OR_VIEW, name=default.t1]] (state=42000,code=40000)

Cause Analysis

The newly created user does not have the permission to operate the Hive component.

Solution

MRS Manager:

  1. Log in to MRS Manager and choose System > Manage Role > Create Role.
  2. Enter a role name.
  3. In the Permission area, select Hive. The Hive administrator permission and the read and write permission for Hive tables are displayed.

  4. Select Hive Read Write Privileges. All databases in the Hive column are displayed.
  5. Select the permissions required by the role and click OK.
  6. On MRS Manager, choose System > Manage User.
  7. Locate the row that contains the created user, and click Modify in the Operation column.
  8. Click Select and Join User Group. To use the Hive service, you must add a Hive group.
  9. Click Select and Add Role and select the role created in 5.
  10. Click OK.

FusionInsight Manager:

  1. Log in to FusionInsight Manager. Choose System > Permission > Role.
  2. Click Create Role, and set Role name and Description.
  3. Set Configure Resource Permission for the role and select Hive Read and Write Permission for the Hive table. All databases in the Hive column are displayed.
  4. Select the permissions required by the role and click OK.
  5. On FusionInsight Manager, choose System > Permission > User.
  6. Locate the row that contains the created user, and click Modify in the Operation column.
  7. Click Add on the right of User Group. To use the Hive service, you must add a Hive group.
  8. Click Add on the right of Role and select the role created in 4.
  9. Click OK.