title: hive.HiveImport: FAILED: SemanticException [Error 10072]: Database does not exist:
body: <p>I am trying to import MySQL database into Hive to analysis of large MySQL Data according to <strong><a href="http://www.percona.com/blog/2013/07/11/mysql-and-hadoop/" rel="nofollow">Blog</a></strong> there are  couple of ways to do this</p>
  
  <ol>
  <li><strong><em>Non realtime: Sqoop</em></strong></li>
  <li><strong><em>Realtime: Hadoop Applier for MySQL</em></strong></li>
  </ol>
  
  <p>so I decided to go with the '<em>Non realtime</em>' approach and I have setup the Hadoop cluster with 4 node, Sqoop and Hive which working fine with following versions</p>
  
  <p><strong>Name</strong>        <strong>Version</strong></p>
  
  <p><strong><em>Apache Hadoop</em></strong>   <em>2.6.0</em></p>
  
  <p><strong><em>Apache Hive</em></strong>   <em>hive-0.14.0</em></p>
  
  <p><strong><em>Apache Sqoop</em></strong>  <em>sqoop-1.4.5.bin__hadoop-2.0.4-alpha</em></p>
  
  <p>Now when I am trying to import data using following command </p>
  
  <p><strong>Import Command</strong></p>
  
  <pre><code>sqoop-import-all-tables --verbose --connect jdbc:mysql://X.X.X.X/edgeowt --username root -P --hive-import --warehouse-dir /user/hive/warehouse --hive-database edgeowt.db  --hive-overwrite
  </code></pre>
  
  <p>then I am getting following error </p>
  
  <p><strong>Error</strong></p>
  
  <pre><code>INFO hive.HiveImport: FAILED: SemanticException [Error 10072]: Database does not exist: edgeowt.db
  15/04/16 13:32:09 ERROR tool.ImportAllTablesTool: Encountered IOException running import job: java.io.IOException: Hive exited with status 88
  </code></pre>
  
  <p>I logged in with Hiveserver2 and check the database, but I can able to see the given database </p>
  
  <pre><code>$HIVE_HOME/bin&gt;beeline
  beeline&gt; !connect jdbc:hive2://localhost:10000 scott tiger org.apache.hive.jdbc.HiveDriver
  0: jdbc:hive2://localhost:10000&gt; show databases;
  +----------------+--+
  | database_name  |
  +----------------+--+
  | default        |
  | edgeowt        |
  +----------------+--+
  </code></pre>
  
  <p>After looking into <em>HDFS file System web interface</em> I realize that the <strong><em>Owner of the DB is different</em></strong> </p>
  
  <pre><code>Permission  Owner   Group       Size    Replication Block Size  Name
  drwxr-xr-x  hduser  supergroup  0 B 0       0 B     candidate
  drwxr-xr-x  scott   supergroup  0 B 0       0 B     edgeowt.db
  drwxr-xr-x  scott   supergroup  0 B 0       0 B     hd_temperature
  </code></pre>
  
  <p>as I am trying to import the data using <strong>hduser</strong> and and the database is created using <strong>scott</strong> user.
  I tried to grant <strong>ALL</strong> previlages to <strong>hduser</strong> on <strong>edgeowt.db</strong> using following command</p>
  
  <pre><code>0: jdbc:hive2://localhost:10000&gt;GRANT ALL ON DATABASE edgeowt TO USER hduser;
  </code></pre>
  
  <p>and check with </p>
  
  <pre><code>0: jdbc:hive2://localhost:10000&gt; SHOW GRANT ON DATABASE edgeowt;
  +-----------+--------+------------+---------+-----------------+-----------------+------------+---------------+----------------+----------+--+
  | database  | table  | partition  | column  | principal_name  | principal_type  | privilege  | grant_option  |   grant_time   | grantor  |
  +-----------+--------+------------+---------+-----------------+-----------------+------------+---------------+----------------+----------+--+
  | edgeowt   |        |            |         | admin           | ROLE            | ALL        | false         | 1429170366000  | scott    |
  | edgeowt   |        |            |         | hduser          | USER            | ALL        | false         | 1429170906000  | scott    |
  +-----------+--------+------------+---------+-----------------+-----------------+------------+---------------+----------------+----------+--+
  </code></pre>
  
  <p>but unable to solve the error , So how can I solve this problem ? or any point to solve this will be helpful.</p>
  
  <p><strong>~/.bashrc</strong></p>
  
  <pre><code># Set JAVA_HOME (we will also configure JAVA_HOME directly for Hadoop later on)
  export JAVA_HOME=/usr/lib/jvm/java-7-oracle
  # Set Hadoop-related environment variables
  export HADOOP_INSTALL=/opt/hadoop
  export PATH=$PATH:$HADOOP_INSTALL/bin
  export PATH=$PATH:$HADOOP_INSTALL/sbin
  export HADOOP_MAPRED_HOME=$HADOOP_INSTALL
  export HADOOP_COMMON_HOME=$HADOOP_INSTALL
  export HADOOP_HDFS_HOME=$HADOOP_INSTALL
  export YARN_HOME=$HADOOP_INSTALL
  export HADOOP_HOME=$HADOOP_INSTALL
  
  # Set hive home 
  export HIVE_HOME=/opt/hive
  export PATH=$PATH:$HIVE_HOME/bin
  
  # Set HCatlog home 
  export HCAT_HOME=$HIVE_HOME/hcatalog
  export PATH=$PATH:$HCAT_HOME/bin
  
  # Set Sqoop home
  export HADOOP_OPTS="$HADOOP_OPTS -Djava.library.path=$HADOOP_HOME/lib/native"
  export SQOOP_HOME=/opt/sqoop
  export SQOOP_CONF_DIR="$SQOOP_HOME/conf"
  export SQOOP_CLASSPATH="$SQOOP_CONF_DIR"
  export PATH=$PATH:$SQOOP_HOME/bin
  </code></pre>
  
  <p><strong><em>EDIT</em></strong></p>
  
  <p>tried with following command still having same error</p>
  
  <pre><code>sqoop-import-all-tables --verbose --connect jdbc:mysql://X.X.X.X/edgeowt --username root -P --hive-import --warehouse-dir /user/hive/warehouse --hive-database edgeowt --hive-overwrite
  </code></pre>