Failed to create table in Hive due to metastore backend database permission issue.

Document created by rsingh on Feb 13, 2016Last modified by rsingh on Feb 13, 2016
Version 2Show Document
  • View in full screen mode

Author: Rajkumar Singh

 

Original Publication Date: April 26, 2015

 

Env :

Hive 0.12

MySQL 5.5 as Metastore backend database.

 

Symptom:

Users can execute the show tables commands but see the following exception when they try to create a table.

 

13/04/02 02:32:44 INFO mapred.JobClient: Cleaning up the staging area hdfs://xxx/user/xxx/.staging/job_201304020010_0080
13/04/02 02:32:44 ERROR security.UserGroupInformation:
PriviledgedActionException as:xxx (auth:SIMPLE) cause:
java.io.IOException: javax.jdo.JDOFatalDataStoreException: Failed to create database '/var/lib/hive/metastore/metastore_db', see the next exception for details.
NestedThrowables: java.sql.SQLException: Failed to create database '/var/lib/hive/metastore/metastore_db', see the next exception for details.
java.io.IOException: javax.jdo.JDOFatalDataStoreException: Failed to create database '/var/lib/hive/metastore/metastore_db', see the next exception for details.
NestedThrowables: java.sql.SQLException: Failed to create database '/var/lib/hive/metastore/metastore_db', see the next exception for details.

 

Root Cause:
User gets the exception due to the permission issue on Metastore backend database.  For example, MySQL.

Solution:
Check whether user is able to create a new table in the configured database(metastore). If not, please provide appropriate permissions for the user.

GRANT ALL PRIVILEGES ON * . * TO 'username'@'hostname'; 
FLUSH PRIVILEGES;

Attachments

    Outcomes