Connecting to databases using standalone CQLSH

Use the standalone CQLSH tool to interact with your database through CQL commands.

The Cassandra Query Language SHell (CQLSH) is a command line shell for interacting with your database through Cassandra Query Language (CQL). This tool provides a useful interface for accessing the database and issuing CQL commands.

Instead of using the native CQL shell that is included in DataStax Enterprise (DSE) or DataStax Distribution of Apache Cassandra (DDAC), the standalone CQLSH client is a separate, lightweight tool you can use to interact with your database.

Tip: Each DataStax Astra database includes an embedded CQLSH instance. In the DataStax Cloud console, navigate to your database and click the CQL Console tab to open a CQLSH instance that is connected to your database.


  1. Download CQLSH. Choose the version for DataStax Astra.
  2. Create a DataStax Astra database.
  3. Download the secure connect bundle to obtain connection credentials for your DataStax Astra database.


  1. Change to the directory where you downloaded the CQLSH tarball and then extract it.
    cd /download_directory
    tar -xvf cqlsh-astra-date-bin.tar.gz

    date is the date that the tarball was released, such as 20200120.

  2. From the directory where you extracted the CQLSH tarball, run the cqlsh script from the command line.

    Use the -b option to specify the location of the secure connect bundle that you downloaded for your database. Pass the username and password for the database using the -u and -p options.

    cd /cqlsh-astra
    ./bin/cqlsh -u username -p password -b /path/to/
    Username for the database.
    Password for the specified username.
    Name of the Astra database you want to connect to. Include the absolute path to the secure connect bundle for the database, such as /Users/myuser/Downloads/


You are connected directly to your Astra database using CQLSH.
Connected to caas-cluster at host_name:9042.
[cqlsh 6.8.0 | DSE | CQL spec 3.4.5 | DSE protocol v2]
Use HELP for help.

Explore your keyspaces

To view all available keyspaces, run the following command:


View the keyspace that you created for your Astra database:


What's next

Switch to your keyspace, which you can use to issue CQL commands to create tables, insert data, and manage database resources:

USE my_keyspace;

See Introduction to CQL to learn more about using CQL commands.