It is very easy to find/display current database information in Hive Command Line Interface (CLI). Just run the below command and terminal will display the current Hive database you are connected to.
hive> set hiveconf:hive.cli.print.current.db=true; hive (my_db)>
This value will be overwritten if you restart the Hive CLI or you open a new one. We can set it my permanently by editing the
~/.hiverc file.
restart the hive CLI after updating the file and it will show which DB you are connected to.
hive (default)> use my_db ; OK Time taken: 3.189 seconds hive (my_db)>
This was a good tip for knowing the current database. Thank you