一、安装mariadb
版本centos7
1、检查Linux服务器是否已安装mariadb
yum list installed mariadb*
2、如果安装了,想要卸载
yum remove mariadb
rm -rf /etc/my.cnf
rm -rf /var/lib/mysql
才能完全删除
3、安装mariadb
在线网络安装
yum install -y mariadb-server
开启服务
systemctl start mariadb.service
输入下方命令,进入数据库内部
mysql
给用户权限,方便后续使用navicat等工具远程登录
show databases;
use mysql;
grant all on *.* to 'root'@'%' identified by '123456';
select user,host,password from user;
二、安装Hive
1、上传hive压缩包到Linux系统解压
tar -zcvf?apache-hive-3.1.1-bin.tar.gz
把解压缩的文件复制到/usr/local/hive
2、修改配置文件
(1)修改hive-env.sh
cd /usr/local/hive/bin
cp ./hive-env.sh.template .????????/hive-env.sh
编辑hive-env.sh
添加下方两行
HADOOP_HOME=/usr/local/hadoop
export HADOOP_HOME
(2)修改hive-site.xml
hive-site.xml文件
编辑指定hive元数据要保存的关系数据库的连接信息
cd /usr/local/hive/bin
cp?./hive-default.xml.template?./hive-site.xml
编辑hive-site.xml
在hive-site.xml文件修改部分节点配置
<configuration>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true</value>
<description>JDBC connect string for a JDBC metastore</description>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
<description>Driver class name for a JDBC metastore</description>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>root</value>
<description>username to use against metastore database</description>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>123456</value>
<description>password to use against metastore database</description>
</property>
</configuration>
3、启动测试
vi /etc/profile
添加下方配置
HIVE_HOME=/usr/local/hive
export HIVE_HOME
PATH=$HIVE_HOME/bin:$PATH
export PATH