Connect to DSE with cqlsh

The main way that you interact with DataStax Enterprise (DSE) is through the CQL shell (cqlsh), a Python-based command-line shell for accessing the database and issuing Cassandra Query Language (CQL) commands.

Install cqlsh

There are three ways to get a DSE-compatible version of cqlsh. All options require Python 3.6 or later.

  • Standalone installation

  • Tarball bundled installation

  • Docker bundled installation

To use a standalone cqlsh installation, download a DSE-compatible version of cqlsh from Fix Central.

  1. Get access to Fix Central. You need the following:

    • An IBMid.

      • If you are an existing IBM customer with an IBMid, you can continue to use your established account.

      • If you don’t have an IBMid, you can create one.

      • If your company uses Enterprise Federation (EF) for authentication with corporate credentials, see the EF documentation.

  2. Download cqlsh from Fix Central:

    1. Sign in to Fix Central.

    2. In the Product selector field, enter IBM DataStax Enterprise.

    3. Select the DSE version of the cqlsh tool you want to install from the Select from IBM DataStax Enterprise list.

    4. Select All in the Platform list, and then click Continue.

    5. On the Identify fixes page, click Continue to use the default Browse for fixes option.

    6. Select the fixes (DSE version of the cqlsh tool) you want to install, and then click Continue.

    7. Review the terms and conditions, and then click I agree.

  3. Click the cqlsh binary tarball link to download the file, for example, cqlsh-6.9.15-bin.tar.gz.

  4. Once the file is downloaded, change to the directory where you want to install cqlsh, and then extract the distribution:

    tar -xzvf cqlsh-**VERSION**-bin.tar.gz

    Replace VERSION with the package version that you downloaded, such as 6.9.15.

If you have installed DSE from the tarball, you can find the cqlsh script in the bin directory of the DSE installation directory.

If you are using the DSE Docker container, you can run the cqlsh script inside the container in the bin directory of the DSE installation directory.

Run cqlsh

  1. Change to the /bin directory of your DSE installation or the directory where you extracted the cqlsh distribution.

  2. Start cqlsh and connect to a local or remote node:

    • Local node

    • Remote node

    • Connect to a local node without authentication:

      bin/cqlsh
    • Connect to a local node with authentication by providing the required username and password:

      bin/cqlsh -u DATABASE_USERNAME -p DATABASE_PASSWORD

    To connect to a remote node, you must specify the IP address of the node in the cluster that you want to connect to:

    bin/cqlsh IP_ADDRESS

    If authentication is required, include the username and password:

    bin/cqlsh IP_ADDRESS -u DATABASE_USERNAME -p DATABASE_PASSWORD

    If cqlsh starts properly, version numbers and the cqlsh prompt appear.

    Result
    Connected to Test Cluster at 127.0.0.1:9042
    Connected to dse-6.9.0-early-preview-cluster at 127.0.0.1:9042.
    [cqlsh 6.8.0 | DSE 6.9.0-early-preview | CQL spec 3.4.5 | DSE protocol v2]
    Use HELP for help.
    cqlsh>

    If cqlsh cannot connect and mentions a different port than 9042, check your ~/.cassandra/cqlshrc file, which could be modifying the defaults.

    For command help, run bin/cqlsh --help.

You can use a cqlshrc configuration file to set options for cqlsh, such as the default host, port, username, and password. Then, start cqlsh with your cqlshrc file:

bin/cqlsh CQLSHRC="~/DIRECTORY_NAME"

For a complete list of options, see the cqlsh reference documentation.

Was this helpful?

Give Feedback

How can we improve the documentation?

© Copyright IBM Corporation 2025 | Privacy policy | Terms of use Manage Privacy Choices

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: Contact IBM