N|Solid
In this tutorial we learn how to manage user in database cassandra. Setting the cassandra database using username and password authentication. Learn how to login using default username and password cassandra, create user with or without password, create user superuser and nosuperuser, modifying user and dropping user.

Create user

Syntax for create user

Before we create user, check the authenticator file cassandra.yaml, must using PasswordAuthenticator.

if not change it and restart cassandra.

for creating user in cassandra we must login as superuser
Create user for the first time in cassandra we must login using default superuser.

Syntax for creating user in cqlsh

In this course we learn
1. User cassandra Case Sensitif ( user “ADMIN” not same with user “admin”)
2. Default user is not superuser

trying login to cassandra using user

Alter User

Superusers can change a user’s password or superuser status. To prevent disabling all superusers, superusers cannot change their own superuser status. Ordinary users can change only their own password. Enclose the user name in single quotation marks if it contains non-alphanumeric characters. Enclose the password in single quotation marks.

Syntax

example

user database nonadmin1 become “SUPERUSER” and changed the password.
notes
switch username without logout

DROP user

DROP USER removes an existing user. In Apache Cassandra™ 2.0.9 and later, you can test that the user exists. Attempting to drop a user that does not exist results in an invalid query condition unless the IF EXISTS option is used. If the option is used, the statement will be a no-op if the user does not exist. You have to be logged in as a superuser to issue a DROP USER statement. Users cannot drop themselves.

Enclose the user name in single quotation marks only if it contains non-alphanumeric characters.

Syntax