1. linux 安装mysql
1.1 安装
注意:centos中安装前需要卸载原有的mariadb,
rpm -qa|grep -i mariadb //查找是否有mariadb
yum remove mariadb-libs-5.5.52-1.el7.x86_64 //卸载
官网下载各种rpm包,依次进行rpm安装。先是common,libs,client,server
rpm -ivh mysql-community-common-5.7.16-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.16-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-compat-5.7.16-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.16-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.16-1.el7.x86_64.rpm
1.2 启动服务
systemctl start mysqld //启动服务
systemctl status mysqld //查看状态
1.3 修改密码
查看初始的随机密码
grep pass /var/log/mysqld.log --color
修改密码
mysql -uroot -p
set global validate_password_policy=0; #密码强度降到最低级
set global validate_password_length=4; #密码长度
alter user 'root'@'localhost' identified by '111111';#设置新密码
>\q退出
重新登陆
> mysql -uroot -p111111
# 创建一个远程连接用户(%任意主机都可以连接进来)
# 以备hive 的安装配置hive-site.xml文件
create user 'root'@'%' identified by '123456' ;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
#刷新权限
Flush privileges;
2. linux 安装hive
2.1 解压
tar -zxvf apache-hive-3.1.2-bin.tar.gz -C /usr/bigdata/hive/
2.2 配置环境变量
vim /etc/profile //配置环境变量
export HIVE_HOME=/usr/hive/apache-hive-2.3.4-bin
export PATH=$PATH:$HIVE_HOME/bin
source /etc/profile //生效变量
2.3 配置hive-site.xml hive-env.sh文件
配置hive-env.sh
export HADOOP_HOME=/usr/hadoop/hadoop-2.7.7
export HIVE_CONF_DIR=/usr/hive/apache-hive-2.3.4-bin/conf
export HIVE_AUX_JARS_PATH=/usr/hive/apache-hive-2.3.4-bin/lib
配置hive-site.xml
<configuration>
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/user/hive_remote/warehouse</value>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
</property>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://slave2:3306/hive?createDatabaseIfNotExist=true&useSSL=false</value>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>root</value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>123456</value>
</property>
</configuration>
2.4 将mysql-connect-java.jar拷贝到hive的lib下
mv mysql-connector-java-5.1.27-bin.jar /hive/apache-hive-3.1.2-bin/lib
2.5 启动hadoop集群
start-all.sh
2.6 启动hive
hive