Hive3中显示当前数据库
场景:
新安装的hive,使用hive进入命令行后,单单显示了“hive>”,并不知道当前数据库名是哪个
解决:
方法一:
使用select语句查看当前数据库
hive> select current_database();
方法二:
使用参数,并配置到hive-site.xml文件,可以重复使用
$ vi hive-site.xml
<property>
<name>hive.cli.print.current.db</name>
<value>true</value>
<description>Whether to include the current database in the Hive prompt.</description>
</property>
重新进入hive后,会直接显示是默认的default数据库,并且更改数据库后其显示的也是当前所在的数据库名。