Create superuser account

This page gives a brief example of using CQL to create a superuser account. It shows how to replace the cassandra superuser account with a new superuser account.

  1. Create a new superuser account:

    CREATE ROLE ROOT_ACCOUNT_NAME
        WITH SUPERUSER = true
        AND LOGIN = true
        WITH PASSWORD = 'ROLE_PASSWORD';

    Replace the following:

    • ROOT_ACCOUNT_NAME: The name of your root account

    • ROLE_PASSWORD: The role password

  2. Make sure the account exists:

    LIST ROLE ROOT_ACCOUNT_NAME;

    Replace ROOT_ACCOUNT_NAME with the name of your root account.

  3. Grant the new superuser account the ALL permission:

    GRANT ALL PERMISSIONS ON ALL KEYSPACES TO ROOT_ACCOUNT_NAME;

    Replace ROOT_ACCOUNT_NAME with the name of your root account.

  4. Check that the new superuser account has the ALL permission:

    LIST ALL PERMISSIONS OF ROOT_ACCOUNT_NAME;

    Replace ROOT_ACCOUNT_NAME with the name of your root account.

  5. Delete the default cassandra superuser account:

    DROP ROLE cassandra;
  6. Make sure the cassandra account is deleted:

    LIST ROLE cassandra;

Was this helpful?

Give Feedback

How can we improve the documentation?

© 2024 DataStax | Privacy policy | Terms of use

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: +1 (650) 389-6000, info@datastax.com