-
1.首先需安装好mysql
service mysql start
-
2.cd hive
mkdir warehouse
-
3.vi /etc/profile(配制环境变量)
export HIVE_HOME
export PATH
hive --version检验环境变量是否配好 -
4.cd /hive/conf
mv hive-env.sh(改名成这个)
(1)vi hive-env.sh
HADOOP_HOME=实际上的路径
export HIVE_CONF_DIR=/opt/hive/conf
export HIVE_AUX_JARS_PATH=/opt/hive/lib```
(2)vi hive-site.xml
```java
<configuration>
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/opt/hive/warehouse</value>
</property>
<property>
<name>hive.metastore.local</name>
<value>true</value>
</property>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://127.0.0.1:3306/hive?createDatabaseIfNotExist=true</value>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>root</value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>ok</value>
</property>
</configuration>
- 5.MySQL驱动包存放到hive/lib下(注意版本一致,不然容易出问题)
- 6.service mysql start
进入mysql
create database hive;
quit;
- 7.初始化
schematool -dbType mysql -initSchema
(删除键容易出现^h
此时可以输入:stty erase ^h)
- 8.输入:hive
进入hive