mysql>GRANT ALL PRIVILEGES ON hivedemo.* TO ‘hiveuser’@'%’ IDENTIFIED BY ‘hivepassword’;
mysql>Exit;
6、配置hive的hive-env.sh:
HADOOP_HOME=${HADOOP_HOME}
export HIVE_CONF_DIR=/home/hadoop/hive-0.9.0/conf
export HIVE_AUX_JARS_PATH=/home/hadoop/hive-0.9.0/lib
7、配置hive的hive-site.xml:
替换:
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:derby:;databaseName=metastore_db;create=true</value>
<description>JDBC connect string for a JDBC metastore</description>
</property>
为:
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://localhost:3306/hivedemo?createDatabaseIfNotExist=true</value>
<description>JDBC connect string for a JDBC metastore</description>
</property>
替换:
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>org.apache.derby.jdbc.EmbeddedDriver</value>
<description>Driver class name for a JDBC metastore</description>
</property>
为:
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
</property>
更改mysql用户名:
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>hiveuser</value>
<description>username to use against metastore database</description>
</property>
更改mysql密码:
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>hivepassword</value>
<description>password to use against metastore database</description>
</property>
9、启动hive,验证是否正确安装部署:
cd /root/test_data/hive-0.9.0/bin
执行 sh hive
执行show databaes;
如果显示default,表示已经正确安装hive.