一 基础环境安装

1.首先在官网内下载mysql数据库安装包,这里是存放在/opt/software目录下

二 解压和安装文件

2.使用 root 用户,将 Hive 安装包 /opt/software/apache-hive-2.0.0-bin.tar.gz 路解压到/usr/local/src 路径下,并将解压后的 apache-hive-2.0.0-bin 文件夹更名为 hive

3.关闭防火墙并设置为开机不启动

三 卸载mariadb数据库,安装mysql数据库

4.查询Linux系统中已安装的mariadb,并将其卸载

5.依次安装mysql安装包

安装mysql server安装包

6.将以下配置信息添加到/etc/my.cnf 文件 symbolic-links=0 配置信息的下方。

default-storage-engine=innodb innodb_file_per_table collation-server=utf8_general_ci init-connect='SET NAMES utf8' character-set-server=utf8  

7.启动MySQL数据库

8.查询MySQL状态为active(running),如为Failed则排查/etc/my.cnf文件

9.查看mysql数据库初始密码

10.MySQL 数据库初始化,执行mysql_secure_installation

[root@master mysql-5.7.18]# mysql_secure_installation 

Securing the MySQL server deployment.

Enter password for user root:        #输入查询到的初始密码

Estimated strength of the password: 100  Change the password for root ? ((Press y|Y for Yes, any other key for No) : y          #输入y

New password:                   #输入新密码

Re-enter new password:                    #再次输入新密码

Estimated strength of the password: 100  Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y           #输入y By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y                  #输入y Success.

Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n                  #输入n

 ... skipping. By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment.

Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y                     #输入y  - Dropping test database... Success.

 - Removing privileges on test database... Success.

Reloading the privilege tables will ensure that all changes made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y                      #输入y Success.

All done!   

11.登录MySQL数据库

[root@master mysql-5.7.18]# mysql -uroot -p Enter password:            #输入新设定的密码 Welcome to the MySQL monitor.  Commands end with ; or \g. Your MySQL connection id is 20 Server version: 5.7.18 MySQL Community Server (GPL)

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> grant all privileges on *.* to root@'localhost'     -> grant all privileges on *.* to root@'localhost' identified by 'password';          # 添加 root 用户本地访问授权,password为自己所设置的密码 mysql> grant all privileges on *.* to root@'localhost'     -> identified by 'password';                        # 添加 root 用户本地访问授权 Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> grant all privileges on *.* to root@'%' identified by 'password';                     # 添加 root 用户远程访问授权 Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> flush privileges;                                           # 刷新授权 Query OK, 0 rows affected (0.00 sec)

mysql> select user,host from mysql.user where user='root';                                           # 查询 root 用户授权情况 +------+-----------+ | user | host      | +------+-----------+ | root | %         | | root | localhost | +------+-----------+ 2 rows in set (0.00 sec)

mysql> exit                               #退出 Bye  

四 配置Hive组件

1 在/etc/profile后面追加以下内容

2 使环境生效

3 修改 Hive 组件配置文件。

切换到 hadoop 用户执行对 Hive 组件的配置操作

将 hive-default.xml.template 文件,更名为 hive-site.xml

4 通过 vi 编辑器修改 hive-site.xml 文件实现 Hive 连接 MySQL 数据库

5 在Hive安装目录中创建tmp文件夹

6 Hive安装配置完成

五 初始化Hive数据

1 将mysql数据库驱动拷贝到/usr/local/src/hive/lib目录下,然后重启hadoop服务

初始化数据库

启动hive

精彩链接

评论可见,请评论后查看内容,谢谢!!!评论后请刷新页面。