Hive基础03、Hive基本库使用
Hive基础03、Hive基本使用
目录
1、查看hive数据库
2、进入Hive
3、库操作
1、查看hive数据库
登录MySQL数据库
mysql -u root -p
密码【123456】
查看【hive】数据库
show databases;
效果如下图:
use hive;show tables;
2、进入Hive
hive
3、库操作
注:【exit;】可以推出状态。
show databases;
4、基本操作
- 查看当前数据库:set hive.cli.print.current.db = true;
- 创建数据库:create database testdb1;
- 查看所有数据库:show databases;
- 使用指定数据库:use testdb1;
- 删除数据库:drop database testdb1;
set hive.cli.print.current.db = true;create database testdb1;show databases;use testdb1;drop database testdb1;
简单居于练习:
创建mytest数据库
create database mytest;show databases;use mytest;
comment 'employee details' #表注释
row format delimited #行格式限定
fields terminated by '\t' #数据分隔
lines terminated by '\n' #行分隔
stored as textfile; #默认文件格式