Support Questions

Find answers, ask questions, and share your expertise

How to open beeline or hive terminal directly without the need of username and password??

avatar

I am running the beeline or hive command on terminal ,it is asking me for username and password.but i want to open beeline or hive cli directly without asking username and password.Please let me know is there any way to permanently set the username and password in beeline.

beeline.png

4 REPLIES 4

avatar

Hi @Gourav Gupta ,

I try this way of connecting and it works well

beeline -u jdbc:hive2://mycluster.openstacklocal:10000 -n user1 -p pass

Is this the answer you are searching for.

Hope this helps

avatar

@Akhil

Yes Akhil..it works fine by the above command but when i am importing table data from Mysql to hive diectly using Sqoop,then it got stucked at username and Password Point.Like in Hiveserver1 ,when we run HIVE command,that will open the hive terminal without asking for username and password.

avatar
Expert Contributor

@Gourav You can use the -n & -p options to specify the username and password. For instance:

beeline -u jdbc:hive2://localhost:10000/default -n username -p password

However, for security reasons, I would not supply it in plaintext as option '-p' does, but rather read a password from a permission-protected password file instead, For instance:

beeline -u jdbc:hive2://localhost:10000/default -n username -w password_file

Also, if you have over the wire encryption enabled, either SASL or SSL, you will have to use different commands. For instance if SASL is enabled and depending on the qop setting, here is an example when qop is set to auth-conf - highest security:

beeline -u "jdbc:hive2:/://localhost:10000/default;sasl.qop=auth-conf" -n username -w password_file

Another example is when you have SSL enabled for the channel, here is a sample connection string:

beeline -u "jdbc:hive2:/://localhost:10000/default;ssl=true;sslTrustStore=/sample/security/keystores/hostJKStruststore.jks;trustStorePassword=password" -n username -w password_file

Hope that helps!

Please accept the answer if it answered your questions.

avatar

@Akhil

Yes Akhil..it works fine by the above command but when i am importing table data from Mysql to hive diectly using Sqoop,then it got stucked at username and Password Point.Like in Hiveserver1 ,when we run HIVE command,that will open the hive terminal without asking for username and password.