一、centos7安装mysql5.7
1.下载mysql相关的rpm包
通过浏览器下载官方rpm包
https://dev.mysql.com/downloads/mysql/5.7.html#downloads
下载包为:
mysql-community-server-5.7.28-1.el7.x86_64.rpm
mysql-community-client-5.7.28-1.el7.x86_64.rpm
mysql-community-common-5.7.28-1.el7.x86_64.rpm
mysql-community-libs-5.7.28-1.el7.x86_64.rpm
mysql-community-libs-compat-5.7.28-1.el7.x86_64.rpm
2.卸载mariadb
# rpm -qa | grep mariadb
# rpm -e --nodeps mariadb-libs-5.5.68-1.el7.x86_64
3.安装mysql5.7
按照此顺序依次安装 common-> libs-> client->server
# rpm -ivh mysql-community-common-5.7.28-1.el7.x86_64.rpm
# rpm -ivh mysql-community-libs-5.7.28-1.el7.x86_64.rpm
# rpm -ivh mysql-community-libs-compat-5.7.28-1.el7.x86_64.rpm
# rpm -ivh mysql-community-client-5.7.28-1.el7.x86_64.rpm
# rpm -ivh mysql-community-server-5.7.28-1.el7.x86_64.rpm(--force --nodeps)
4.启动mysql
# systemctl start mysqld
5.设置为开机自动启动
# systemctl enable mysqld
6.修改root本地登录密码
6.1 获取临时密码
$ grep 'temporary password' /var/log/mysqld.log
6.2 登录
$ mysql -u root -p
6.3 修改密码
(5.5+版本要求密码:字母大小写、数字、特殊字符)
mysql> set password = password("123456");
修改密码策略
Poliy performed
0 or LOW length
1 or MEDIUM length; numeric, lowercase/uppercase, and special characters
2 or STRONG length; numeric, lowercase/uppercase, and special characters
比如修改为6位密码
查看密码策略
mysql> show variables like 'validate_password%';
修改密码策略
mysql> set global validate_password_policy=0;
修改密码最低长度
mysql> set global validate_password_length=6;
修改密码
mysql> alter user 'root'@'localhost' identified by '123456';
二、Hive的安装(本地模式)
必须先安装HDFS和Yarn并启动服务进程
1.解压安装
$ tar -zxvf hive-1.1.0-cdh5.14.2.tar.gz -C /opt/cdh-5.14.2/
2.在HDFS上 创建/tmp目录和hive仓库
$ bin/hdfs dfs -mkdir -p /user/hive/warehouse
$ bin/hdfs dfs -mkdir /tmp
$ bin/hdfs dfs -chmod g+w /user/hive/warehouse
$ bin/hdfs dfs -chmod g+w /tmp
3.修改配置
$ cd /opt/cdh-5.14.2/hive-1.1.0-cdh5.14.2/
$ touch conf/hive-site.xml
$ cp conf/hive-log4j.properties.template conf/hive-log4j.properties
$ cp conf/hive-env.sh.template conf/hive-env.sh
3.1修改hive-env.sh
export JAVA_HOME=/opt/cdh-5.14.2/jdk1.8.0_112
HADOOP_HOME=/opt/cdh-5.14.2/hadoop-2.6.0-cdh5.14.2
export HIVE_CONF_DIR=/opt/cdh-5.14.2/hive-1.1.0-cdh5.14.2/conf
3.2修改hive.site.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?><!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<configuration>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://192.168.1.231:3306/metastore?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>123456</value>
</property>
</configuration>
3.3修改日志配置hive-log4j.properties
hive.log.dir=/opt/cdh-5.14.2/hive-1.1.0-cdh5.14.2/logs
3.4拷贝jdbc驱动到hive的lib目录
$ cp mysql-connector-java-5.1.34-bin.jar /opt/cdh-5.14.2/hive-1.1.0-cdh5.14.2/lib/