hive 在mysql中创建备用数据库

修改hive-site.xml
<property>
    <name>javax.jdo.option.ConnectionURL</name>
    <value>jdbc:mysql://vmtmstorm01:3306/hive2?useUnicode=true&amp;characterEncoding=UTF-8</value>
  </property>
  <property>
    <name>javax.jdo.option.ConnectionDriverName</name>
    <value>com.mysql.jdbc.Driver</value>
  </property>
  <property>
    <name>javax.jdo.option.ConnectionUserName</name>
    <value>hive</value>
  </property>
  <property>
    <name>javax.jdo.option.ConnectionPassword</name>
    <value>123</value>
  </property>
在mysql中创建database库:
create database hive2 DEFAULT CHARACTER SET utf8;
grant all on hive2.* TO 'hive'@'%' IDENTIFIED BY '123';
在hive2数据库中创建hive元数据存放的库表
mysql>source /opt/cloudera/parcels/CDH/lib/hive/scripts/metastore/upgrade/mysql/hive-schema-0.12.0.mysql.sql

你可能感兴趣的:(mysql)