ALTER ROLE
Changes password or hashed password and sets superuser or login options.
Synopsis
ALTER ROLE <role_name> [ ( WITH PASSWORD '<role_password>' | WITH HASHED PASSWORD '<hashed_role_password>' ) ] [ [ AND ] LOGIN = ( true | false ) ] [ [ AND ] SUPERUSER = ( true | false ) ] [ [ AND ] OPTIONS = { <option_map> } ] ] ;
Syntax legend
Syntax conventions | Description |
---|---|
UPPERCASE |
Literal keyword. |
Lowercase |
Not literal. |
|
Variable value. Replace with a user-defined value. |
|
Optional.
Square brackets ( |
|
Group.
Parentheses ( |
|
Or.
A vertical bar ( |
|
Repeatable.
An ellipsis ( |
|
Single quotation ( |
|
Map collection.
Braces ( |
Set, list, map, or tuple.
Angle brackets ( |
|
|
End CQL statement.
A semicolon ( |
|
Separate the command line options from the command arguments with two hyphens ( |
|
Search CQL only: Single quotation marks ( |
|
Search CQL only: Identify the entity and literal value to overwrite the XML element in the schema and solrConfig files. |
- WITH PASSWORD | WITH HASHED PASSWORD
-
Change the password or hashed password of the logged in role. Superusers (and roles with ALTER PERMISSION to a role) can also change the password or hashed password of other roles.
- SUPERUSER
-
Enable or disable superuser status for another role, that is any role other than the one that is currently logged in. Setting superuser to false, revokes permission to create new roles; disabling does not automatically revoke the AUTHORIZE, ALTER, and DROP permissions that may already exist.
- LOGIN
-
Enable or disable log in for roles other than currently logged in role.
- OPTIONS
-
Reserved for external authenticator plug-ins.
Example
Change the password for a role:
ALTER ROLE sandy WITH PASSWORD = 'bestTeam';
or with a hashed password:
ALTER ROLE sandy WITH PASSWORD = '$2a$10$Mvs4GDHlNG8MhYe5SFi7ge1R1SMbScIPVtKReSEKpqwcQOvep0Zqq';
Alter a role to make it a superuser:
ALTER ROLE sandy WITH SUPERUSER=true;