Logging in using cqlsh

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

To avoid having to pass credentials for every login using cqlsh, you can create a .cqlshrc file, or cqlshrc file in Cassandra 1.2.9 and later. Create this file in your home directory, or in ~/.cassandra in Cassandra 1.2.9 and later. When present, this file passes default login information to cqlsh.

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 directory or ~/.cassandra directory and name it .cqlshrc or cqlshrc, as previously discussed.
  3. Set permissions on the file.
    To protect database login information, ensure that the file is secure from unauthorized access.
    Note: Sample .cqlshrc files are available in:
    • Packaged installs

      /usr/share/doc/dse-libcassandra

    • Binary installs

      <install_location>/conf