Start cqlsh
The CQL shell (cqlsh) is a Python-based command line interface for running CQL commands interactively with support for tab completion.
cqlsh requires Python 2.7 or Python 3.6 through 3.11.
Use cqlshrc for authentication
You can use a cqlshrc file to set default credentials when launching cqlsh.
For more information about the cqlshrc file, see Configuring a cqlshrc file.
-
Create a file named
cqlshrcor modify an existing one. -
Specify the literal string
tokenforusernameand your Astra DB application token forpassword.[authentication] username = token password = AstraCS:... -
Save the file in
home/.cassandradirectory or yourcqlshinstallation directory. -
Set permissions on the file to prevent unauthorized access if the password is stored in plain text. If you are using
cqlshin a production environment, use secure references for passwords. The file must be readable by the user that startscassandra.chmod 440 'home/.cassandra/cqlshrc' -
Check the permissions on
home/.cassandra/cqlshrc_historyto ensure that plain text passwords are not compromised.