Hive安装Mysql安装

在集群上运行hbase的jar程序时报找不到scan的类库,输入

export HADOOP_CLASSPATH=$HBASE_HOME/lib/*:$CLASSPATH

安装mysql
1.先删除linux上相关mysql

yum remove mysql-libs

是否继续?[y/N]:y
2.下载 mysql57-community-release-el7-8.noarch.rpm 的 YUM 源:

wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm

3.安装 mysql57-community-release-el7-8.noarch.rpm:

rpm -ivh mysql57-community-release-el7-8.noarch.rpm

安装完后,cd /etc/yum.repos.d/

mysql-community.repo
mysql-community-source.repo

4.安装mysql service

yum install mysql-server

执行y

  1. 安装完毕删除

    rm -rf mysql57-community-release-el7-8.noarch.rpm
    

6.启动mysql

service mysqld start

7.查看root的默认密码

cat /var/log/mysqld.log | grep password

8.登录mysql

mysql -uroot -p

9.修改root的默认密码

alter user 'root'@'localhost' identified by 'Www_110';

10.创建hive的数据库

create database hive;

11.创建一个用户,一般操作不要用root

create user 'hiveme'@'%' identified by 'Www_110';

12.给刚创建的用户授权

grant all on hive.* TO 'hiveme'@'%';
grant all on hive.* TO 'hiveowner'@'localhost' identified by 'Www_110';

Hive安装
1.官网下载安装包,上传到服务器,解压
2.配置环境变量

vim /etc/profile
export HIVE_HOME=/root/hd/apache-hive-2.3.3-bin
export PATH=$PATH:$JAVA_HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$HBASE_HOME/bin:$HIVE_HOME/bin

生效

source /etc/profile

3.配置hive-site.xml
先生成一个hive-site.xml

cp hive-default.xml.template hive-site.xml

删除所有esc ggvG d

把如下信息复制到hive-site.xml




 
    javax.jdo.option.ConnectionURL
    jdbc:mysql://ip:3306/hive?useSSL=false

           

    javax.jdo.option.ConnectionDriverName
    com.mysql.jdbc.Driver
   


    javax.jdo.option.ConnectionUserName
    hiveowner
   


    javax.jdo.option.ConnectionPassword
    Welcowww
                  

4.初始化mysql

schematool -dbType mysql -initSchema

5.找不到jar

org.apache.hadoop.hive.metastore.HiveMetaException: Failed to load driver
Underlying cause: java.lang.ClassNotFoundException : com.mysql.jdbc.Driver

6.官网下载jar

https://downloads.mysql.com/archives/c-j/

下载解压获取jar
7.复制jar到hive到lib

 scp -r /Users/hh/desktop/mysql-connector-java-5.1.46-bin.jar hh555:/root/hd/apache-hive-2.3.3-bin/lib/

8.再次重新初始化mysql

schematool -dbType mysql -initSchema

hive安装完毕!

你可能感兴趣的:(Hive安装Mysql安装)