Logging in using cqlsh

How to create a cqlshrc file to avoid having enter credentials every time you launch cqlsh.

Typically, after configuring authentication, you log into cqlsh using the -u and -p options to the cqlsh command. To avoid having enter credentials every time you launch cqlsh, you can create a .cassandra/cqlshrc file. When present, this file passes default login information to cqlsh. The cqlshrc.sample provides an example.

The location of the cqlshrc.sample file depends on the type of installation:
Package installations /etc/cassandra/cqlshrc.sample
Tarball installations install_location/conf/cqlshrc.sample

Procedure

  1. Open a text editor and create a file that specifies a user name and password.
    [authentication]
    username = fred
    password = !!bang!!$
  2. Save the file in your home/.cassandra directory and name it cqlshrc.
  3. Set permissions on the file.
    To protect database login information, ensure that the file is secure from unauthorized access.