1.安装mysql(参考文章:centos7.8安装Mysql8.4-CSDN博客)
2.将mysql驱动拷贝到/opt/module/hive/lib目录下 (直接windows通过finalShell上传)
3./opt/module/hive/conf目录下新建hive-site.xml文件,进行配置
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://slave01:3306/metastore?useSSL=false</value>
<description>
JDBC connect string for a JDBC metastore.
To use SSL to encrypt/authenticate the connection, provide database-specific SSL flag in the connection URL.
For example, jdbc:postgresql://myhost/db?ssl=true for postgres database.
</description>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.cj.jdbc.Driver</value>
<description>Driver class name for a JDBC metastore</description>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>root</value>
<description>用户名</description>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>Yt123456.</value>
<description>密码</description>
</property>
<!--hive默认在HDFS上的目录-->
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/user/hive/warehouse</value>
</property>
</configuration>
4.在Mysql中创建数据库metastore
5.初始化元数据库(mysql)
schematool -dbType mysql -initSchema -verbose
6.测试