cp mysql-connector-java-8.0.13.jar $HIVE_HOME/lib
- 修改配置文件
cd $HIVE_HOME/conf
$ cp hive-default.xml.template hive-site.xml
配置如下
<configuration>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://127.0.0.1:3306/hive_data?createDatabaseIfNotExist=true</value>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.cj.jdbc.Driver</value>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>hive</value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>hive</value>
</property>
<property>
<name>hive.querylog.location</name>
<value>/home/hive2.1/tmp</value>
</property>
<property>
<name>hive.exec.local.scratchdir</name>
<value>/home/hive2.1/tmp</value>
</property>
<property>
<name>hive.downloaded.resources.dir</name>
<value>/home/hive2.1/tmp</value>
</property>
</configuration>
cd $HIVE_HOME/conf
$ cp hive-env.sh.template hive-env.xml
添加hadoop目录地址: HADOOP_HOME=/usr/local/hadoop-2.8.5
- 初始化数据
$HIVE_HOME/bin/schematool -dbType mysql -initSchema
- 进入客户端
$HIVE_HOME/bin/hive