You can also use the
cockroach user command to add or change a user's password.
- Password creation and alteration is supported only in secure clusters for non-
The user must have the
UPDATE privileges on the
|The name of the user whose password you want to create or add.
|Let the user authenticate their access to a secure cluster using this new password. Passwords should be entered as string literal. For compatibility with PostgreSQL, a password can also be entered as an identifier, although this is discouraged.
Change password using a string literal
> ALTER USER carl WITH PASSWORD 'ilov3beefjerky';
ALTER USER 1
Change password using an identifier
The following statement changes the password to
ilov3beefjerky, as above:
> ALTER USER carl WITH PASSWORD ilov3beefjerky;
This is equivalent to the example in the previous section because the password contains only lowercase characters.
In contrast, the following statement changes the password to
thereisnotomorrow, even though the password in the syntax contains capitals, because identifiers are normalized automatically:
> ALTER USER carl WITH PASSWORD ThereIsNoTomorrow;
To preserve case in a password specified using identifier syntax, use double quotes:
> ALTER USER carl WITH PASSWORD "ThereIsNoTomorrow";
- Create Security Certificates
- Other SQL Statements