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
cqlshrc
or modify an existing one. -
Specify the literal string
token
forusername
and your Astra DB application token forpassword
.[authentication] username = token password = AstraCS:...
-
Save the file in
home/.cassandra
directory or yourcqlsh
installation directory. -
Set permissions on the file to prevent unauthorized access if the password is stored in plain text. If you are using
cqlsh
in 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_history
to ensure that plain text passwords are not compromised.