1、配置MYSQL
bash
mysql> alter user 'root'@'localhost' identified by 'Yang3135989009';
Query OK, 0 rows affected (0.00 sec)
mysql> grant all on *.* to 'root'@'%';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
2、配置Hadoop
(1)进入Hadoop用户
bash
hadoop@node1:/export/server/hadoop/etc/hadoop$ vim core-site.xml
(2)修改文件如下
给予Hadoop用户权限
bash
</property>
<property>
<name>hadoop.proxyuser.hadoop.hosts</name>
<value>*</value>
</property>
<property>
<name>hadoop.proxyuser.hadoop.groups</name>
<value>*</value>
</property>
3、下载解压Hive
需要注意,此处应该切换到Hadoop用户
hive下载链接\][http://archive.apache.org/dist/hive/hive-3.1.3/apache-hive-3.1.3-bin.tar.gz](http://archive.apache.org/dist/hive/hive-3.1.3/apache-hive-3.1.3-bin.tar.gz "http://archive.apache.org/dist/hive/hive-3.1.3/apache-hive-3.1.3-bin.tar.gz")
```bash
# 解压到node1服务器的:/export/server/内
tar -zxvf apache-hive-3.1.3-bin.tar.gz -C /export/server/
# 设置软连接
ln -s /export/server/apache-hive-3.1.3-bin /export/server/hive
```
## 4、下载MySQL驱动
需要注意,此处应该将用户切换为Hadoop。
\[MySQL的驱动包\]:[https://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.34/mysql-connector-java-5.1.34.jar](https://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.34/mysql-connector-java-5.1.34.jar "https://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.34/mysql-connector-java-5.1.34.jar")
```bash
# 将下载好的驱动jar包,放入:Hive安装文件夹的lib目录内
mv mysql-connector-java-5.1.34-sources.jar /export/server/hive/lib/
```
## 5、配置Hive
### (1)修改hive-env.sh名称并配置path
目录:
```bash
hadoop@node1:/export/server/hive/conf$ pwd
/export/server/hive/conf
```
改名:
```bash
hadoop@node1:/export/server/hive/conf$ mv hive-env.sh.template hive-env.sh
```
配置:
```cs
export HADOOP_HOME=/export/server/hadoop
export HIVE_CONF_DIR=/export/server/hive/conf
export HIVE_AUX_JARS_PATH=/export/server/hive/lib
```
### (2)创建hive-site.xml
```bash