安装hive的坑
登录mysql
GRANT ALL ON *.* to '用户名'@'主机' IDENTIFIED BY ‘1’;
https://blog.csdn.net/qi1840439776/article/details/81109508?utm_medium=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.control&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.control
基本使用
touch student.txt
vim student.txt
#注意以 tab 键间隔
1 hadoop
2 linux
3 号码
4 的世界
#启动 hive
bin/hive
创建数据库,如test
hive> create database test;
hive> show databases;
use test;
#显示 数据库中的表
show tables;
#删除已创建的 student 表
drop table student;
# 创建 student 表, 并声明文件分隔符’\t’ 创建表,表的结构,要和文件的结构一致
create table student(id int,name string) row format delimited fields terminated by " ";
#加载文件到 student 数据库表中。
load data local inpath '文件所在目录' into table student;
#也可以上传文件到相应的hdfs目录下
hadoop fs -put 文件名 /user/hive/warehouse/test.db/表明/
#Hive 查询结果
select * from student;
create table shuju(sheng string,shi string,shu int,shu int) row format delimited fields terminated by " ";
以" "隔开建表
create table student(id int,name string) row format delimited fields terminated by " ";