java.sql.SQLException: Failed to start database 'metastore_db' ERROR, while initializing database using hive java.sql.SQLException: Failed to start database 'metastore_db' ERROR, while initializing database using hive hadoop hadoop

java.sql.SQLException: Failed to start database 'metastore_db' ERROR, while initializing database using hive


It seems to be an issue with creating the metastore. I solved this by creating a directory and setting the value to that directory as follows:

step-1: create a directory on home say its: hive-metastore-dir

step-2: being super user edit the hive-site.xml (its in: /usr/lib/hive/conf) as follows:

<name>javax.jdo.option.ConnectionURL</name>  <value>jdbc:derby:;databaseName=/var/lib/hive/metastore/metastore_db;create=true</value>

to

<name>javax.jdo.option.ConnectionURL</name>   <value>jdbc:derby:;databaseName=/home/hive-metastore-dir/metastore/metastore_db;create=true</value>

step-3: start the CLI as sudo hive and perform your queries.


You may login to hive client from a directory where the user has write access. By default, hive will try to create temporary directory in local and HDFS when a shell is opened up.


follow this steps if you are using CDH1. copy /usr/lib/hive/conf/hive-site.xml and paste into /usr/lib/spark/conf/

This will solve the problem of "metastore_db" error

Thanks