Support Questions

Find answers, ask questions, and share your expertise
Celebrating as our community reaches 100,000 members! Thank you!

Hive cli asking username and password


I have a new cluster with HDP- without kerberos or any security. But when I use hive cli it is asking username and password to enter:


[root@ip-XXX-XX-XX-XXX ~]# hive
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/hdp/!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/hdp/!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See <a href="<a href="" target="_blank"></a>" target="_blank"><a href="</a" target="_blank"></a</a>> for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Connecting to jdbc:hive2://hostname1:2181,hostname2:2181,hostname3:2181/default;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2
Enter username for jdbc:hive2://hostname1:2181,hostname2:2181,hostname3:2181/default:
Enter password for jdbc:hive2://hostname1:2181,hostname2:2181,hostname3:2181/default:
19/10/31 06:26:10 [main]: INFO jdbc.HiveConnection: Connected to hostname2:10000
Connected to: Apache Hive (version
Driver: Hive JDBC (version
Beeline version by Apache Hive
0: jdbc:hive2://hostname1:2181,h>



It should directly go inside hive cli. Could you please let me know what property I need to change.


Super Collaborator

hive cli is deprecated in HDP3.x version and  executing it would take you to the same process of beeline. A new variable is set in script USE_BEELINE_FOR_HIVE_CLI=true which will make hive cli  session to go use beeline. 


It is no longer recommended to use hive cli. Please use beeline session in HDP 3.x


If you understand the risks of using hive CLI and still want to use, then change the script to set USE_BEELINE_FOR_HIVE_CLI=false which we don't recommend, but this is one way of making hive cli to work in HDP 3.


Without authentication configured on hive, you can give any name and password at beeline prompt and beeline will allow the access. Even blank username/password is accepted, but this would set user name as 'anonymous' .

Master Mentor


Either way HIVE or Beeline you MUST provide username /password to authenticate to be able to execute any SQL statement against the DB. See below examples

Hive CLI

[hive@calgary ~]$ hive
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Connecting to jdbc:hive2://,;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2
Enter username for jdbc:hive2://, hive
Enter password for jdbc:hive2://, ****


Beeline Connection

[hive@london ~]$ beeline
Beeline version 1.2.1000. by Apache Hive
beeline> ! connect jdbc:hive2://;principal=hive/
Connecting to jdbc:hive2://;principal=hive/
Enter username for jdbc:hive2://;principal=hive/
Enter password for jdbc:hive2://;principal=hive/
Connected to: Apache Hive (version 1.2.1000.
Driver: Hive JDBC (version 1.2.1000.
0: jdbc:hive2://> show databases;

| database_name |
| default                   |
| uxbribge               |
| White_city          |
3 rows selected (2.863 seconds)


If you have ranger plugin enable for hive then you will have authorization centrally handles by Ranger.