save password in text file and connect as below:)
[root@sandbox ~]# beeline -u 'jdbc:hive2://sandbox.hortonworks.com:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2' -n rajesh -w pass
WARNING: Use "yarn jar" to launch YARN applications.
Connecting to jdbc:hive2://sandbox.hortonworks.com:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2
Connected to: Apache Hive (version 1.2.1000.2.5.0.0-817)
Driver: Hive JDBC (version 1.2.1000.2.5.0.0-817)
Transaction isolation: TRANSACTION_REPEATABLE_READ
Beeline version 1.2.1000.2.5.0.0-817 by Apache Hive
0: jdbc:hive2://sandbox.hortonworks.com:2181/>