Shashanth
Shashanth

Reputation: 5180

Failed to create database 'metastore_db', see the next exception for details

I'm getting the following exception while trying to start the hive in Ubuntu 14.04 LTS,Caused by: java.sql.SQLException: Failed to create database 'metastore_db', see the next exception for details. Hadoop installation is correct and it's working fine. Please tell me anyone what's problem?

Upvotes: 2

Views: 10171

Answers (5)

ISHAAN
ISHAAN

Reputation: 3

After spending some(lot) of time I got that issue is with creating that directory metastore_db inside DERBY_HOME/bin path was already there and I didn't had admin access for this you either:

  1. delete that folder by using admin rights.
  2. open hive-site.xml inside HIVE_HOME/conf path open in notepad and check connection string there change the database name to something else, it worked for me.

Upvotes: 0

Vishal Barvaliya
Vishal Barvaliya

Reputation: 345

it is happening because you are on the other folder than your hive is installed. so first of all change directory to the folder where your hive is installed and you and after that try to run hive once again. and the hive should work properly. Best of luck.

Upvotes: 0

DJAdmin
DJAdmin

Reputation: 77

The reason for above error is, the user through which you are login doesn't have permission to write in that particular directory. I mean the directory in which you are running the schematool command.

For example my setup of Apache Hive was in /opt/apache-hive-3.1.2-bin I ran the command :- sudo chown -R hadoopusr /opt/apache-hive-3.1.2-bin/

enter image description here

Upvotes: 0

drublackberry
drublackberry

Reputation: 248

Similar to @dk14, In my case, I was in a folder on which I had no permission to write as user, moved directory and worked fine.

Upvotes: 0

Prakhar Srivastava
Prakhar Srivastava

Reputation: 69

It is because you're not in the same folder where you have created your metadata. I was facing the same problem because I was in my main user folder. When I changed the folder from main user to hduser my hive stated working. See the mistake I tried to find the xml file but it was not their so I searched and found where it was.

Upvotes: 7

Related Questions