Modifies a database account.
Syntax
ALTER USER role_name IDENTIFIED BY password REPLACE prev_password
Description
If you assume a role that does not have the CREATEROLE
permissions, you can execute the ALTER USER… IDENTIFIED BY statement to change the
password. If you assume an unauthorized role and PASSWORD_VERIFY_FUNCTION
is set to NULL
in the configuration file, you must include the REPLACE
clause and the existing password in the statement. If a non-superuser uses the REPLACE
clause, the server compares the password that you enter with the existing password.
If the passwords do not match, an error is reported.
Only a privileged account can change the password.
Parameters
Parameter | Description |
---|
Parameter | Description |
---|---|
role_name | The name of the role whose password is to be changed. |
password | The new password of the role. |
prev_password | The previous password of the role. |
Examples
Execute the following statement to change a user password:
ALTER USER john IDENTIFIED BY 'xyRP35z' REPLACE '23PJ74a';