Hive内容+配置

mysql安装步骤
1.开网卡,设置-->网络-->网卡2启用,选择"网络地址转换"-->启动虚拟机,联网测试
2.查看msyql包
3.安装服务,因为是联网,所以直接执行yum命令:yum install mysql-server
4.配置/etc/my.cnf,加一个编码的配置,
5.设置开机自启
6.启动它service mysqld start
7.初始化root密码
8.登录 mysql -u root -p 回车后输入密码
9.密码错误的处理:
service mysqld stop 关闭服务
Mysqld_safe --user=root --skip-grant-tables 进入安全模式,会卡住,另起一个终端写下边东西
mysql -u root 只输入账户登录
use mysql 进入mysql
update user set password=password("new_pass") where user="root"; 设置新密码,这一句话,只有"new_pass"设置成实际的密码,其他都是原样抄下来
flush privileges; 刷新

错误提示:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

10.登陆成功,设置hive库,设置mysql的免密登录

hive步骤:
1.上传文件
2.解压
3.配置hive-site.xml文件
4.配置hive-env.sh文件 拷贝hive-env.sh.template
5.配置/etc/profile文件
6.追加jdbc的架包

遇到问题:
1.网卡的事
2.安全模式
3.有个运行时异常.

hive建表
create [external] table [if not exists] 表名(
列名 数据类型,
列名 数据类型
)
row format delimited
fields terminated by ' '
lines terminated by ' '
collection items terminted by ' '
map keys terminated by ' '
partitioned by()
into num_buckets buckets
stored as textfile
location ' '

1.external 外部表关键字 不写表示内部表,也叫管理表
2.if not exists 判断是否存在,存在就不建了.
3.comment 表注释 给表的解释
4.row format 设置文件的格式化内容
delimited fields terminated by ' ' 设置一行上每个列之间的分割
lines terminated by '' 设置行分割
5. collection items terminated by '' 集合型和数组型和对象型数据的内部分割
map keys terminated by '' map集合的内部分割
6.partitioned by() 分区表 把表中的数据分到不同的地方
into num_buckets buckets 分桶表 把表分到不同的地方
分桶表中的分割原则是按照表中已有的列进行分割的.而分区表中的分割原则是不能再表中出现的列

7.stored as textfile 存储文件的类型,默认是文本
8.location '' 设置文件位置.

--外部表
create external table aa(
id int,
name string)
location ''
partitioned by()
row format

加载数据
load data local inpath '/root/text/...txt' into table 表名 linux本地
load data inpath '/usr/hive/...' into table 表名 hdfs路径
hdfs hive数据库目录下

原文地址:https://www.cnblogs.com/zjc23/p/14143359.html