You can use the ALTER USER syntax to change the password of the specified user.
Applicable engines and versions
The ALTER USER syntax is applicable to all versions of LindormTable and LindormTSDB.
Syntax
alter_user_statement ::= ALTER USER [IF EXISTS] user_identifier SET PASSWORD = 'newpassword'
[ WHERE OLDPASSWORD = 'oldpassword'];
Parameters
The ALTER USER syntax can be used only to modify the password but not the name of a user.
User name (user_identifier)
The user whose password you want to modify.
If the specified user name does not exist and the IF EXISTS
condition is not specified in the statement, an error is returned to indicate that the user does not exist. If the IF EXISTS
condition is specified in the statement, the execution of the statement is terminated and no error is returned.
New password (SET PASSWORD)
The specified new password must be of the VARCHAR type.
Old password (WHERE OLDPASSWORD)
When you use the ALTER USER syntax to change the password of a user in LindormTable, you must add the
WHERE
condition to specify the old password for verification.The specified old password must be of the VARCHAR type.
Examples
Use the administrator user to change the password
Use the administrator user to change the password of the test_user
user to fda.@
.
ALTER USER IF EXISTS test_user SET PASSWORD = 'fda.@';
Use a regular user to change the password
Use the regular test_user
to change its own password to fda.@
.
ALTER USER test_user SET PASSWORD = 'fda.@' WHERE OLDPASSWORD = 't12a@Hi';