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.
-
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
-
-
Make sure the account exists:
LIST ROLE ROOT_ACCOUNT_NAME;
Replace
ROOT_ACCOUNT_NAME
with the name of your root account. -
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. -
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. -
Delete the default
cassandra
superuser account:DROP ROLE cassandra;
-
Make sure the
cassandra
account is deleted:LIST ROLE cassandra;