1.使用bin/hive -help
查询hive的帮助
2.使用bin/hive
进入hive的命令行
3.基本命令:
- 查看数据库
show databases;
- 查看表名
show tables;
- 在hive cli命令窗口中查看hdfs文件系统
dfs -ls /;
- 在hive cli命令窗口中查看本地文件系统
! ls /...
- 退出hive cli
quit;
或者exit;
都可以,在新版本的hive里面没有区别了。
-
查询后信息显示配置
在hive-site.xml文件中添加如下配置信息,就可以实现显示当前数据库,以及查询表的头信息配置
<property>
<name>hive.cli.print.header</name>
<value>true</value>
</property>
<property>
<name>hive.cli.print.current.db</name>
<value>true</value>
</property>