CentOS中hive与mysql安装
一、安装前提
- 已经在本地下载好的hive安装包(hive3.1.2)
- hadoop已经安装好了(hadoop3.2.1)
- jdk已经安装好了(jdk1.8)
二、hive安装
-
下载路径:
http://hive.apache.org/downloads.html
-
将下载好的 apache-hive-3.1.2-bin.tar.gz上传到虚拟机上
-
解压 apache-hive-3.1.2-bin.tar.gz
tar -zxvf apache-hive-3.1.2-bin.tar.gz
-
将hive移动到opt目录下
mv apache-hive-3.1.2-bin /opt/
-
将apache-hive-3.1.2-bin 更改名字成 hive
mv apache-hive-3.1.2-bin /opt/hive/
-
进入hive目录中的bin目录下启动hive
cd /hive/bin/
启动hive:./hive
-
查看数据库:(第一次使用会出现问题,详情请转到第五部分)
show databases;
-
数据库的操作
创建数据库:show database test;
使用数据库: use test 创建表: create table students (name string, age int, sex string); 查看表: show tables; 查看表结构: desc students;
添加数据: insert into students values ('suger', 20, 'boy'); 查询数据: select * from students;