ALTER USER
On this page
The ALTER USER command alters settings associated with the user.
Syntax
ALTER USER user[@host][IDENTIFIED BY 'password'] [ACCOUNT UNLOCK][SET [DEFAULT RESOURCE POOL = poolname][FAILED_LOGIN_ATTEMPTS = integer] [PASSWORD_LOCK_TIME = integer]][REQUIRE {SSL | NONE}]
Arguments
-
user: Username of the SingleStore database user.
-
host: The host that the user can connect from.
For example, specifying localhostmeans the user account can be used only when connecting from the local host.If no host is explicitly specified, the %wildcard is used, which allows the user to connect from any host. -
password: An optional database connection password for the user.
-
poolname: The new default resource pool for the user.
-
ACCOUNT UNLOCK: Unlocks an account that has been locked out due to exceeding the failed login attempts limit.
-
FAILED_
LOGIN_ ATTEMPTS: Together with PASSWORD_, specifies the failed login attempt lockout behavior.LOCK_ TIME FAILED_is the number of failed attempts allowed before the account is locked out.LOGIN_ ATTEMPTS Default is 0, which means there is no restriction.When set to a value greater than or equal to 1,PASSWORD_must also be specified.LOCK_ TIME -
PASSWORD_
LOCK_ TIME: Together with FAILED_, specifies the failed login attempt lockout behavior.LOGIN_ ATTEMPTS PASSWORD_is the number of seconds a locked out account must wait before reattempting to log in.LOCK_ TIME For more information about failed login attempt lockout behavior, refer to SingleStore User Management.
-
REQUIRE:
SSLoption ensures that the user connects via SSL.NONEspecifies that SSL is not required for the connection.
Remarks
-
Users must have
GRANTpermission to execute theALTER USERcommand. -
When any non-password attributes (for example,
REQUIRE SSL) are modified, resetting the password is not required. -
If an account is locked either manually using the
ALTER USER … ACCOUNT LOCKcommand or automatically as a result of exceeding the values specified forFAILED_andLOGIN_ ATTEMPTS PASSWORD_arguments, then restarting the cluster removes the lock and returns the account’s status toLOCK_ TIME ONLINE.The account lock needs to be explicitly re-applied after the cluster is back online and/or automated as part of the customer’s operational procedures. Users can confirm the lock state before and after a restart by viewing the ACCOUNT_column in theSTATUS information_view.schema. USERS -
This command causes implicit commits.
Refer to COMMIT for more information. -
Refer to the Permissions Matrix for the required permissions.
Examples
-
The following example demonstrates how to add a new user with a resource pool, and then change the resource pool.
CREATE USER joe WITH DEFAULT RESOURCE POOL = general;ALTER USER joe SET DEFAULT RESOURCE POOL = executive;ALTER USER joe ACCOUNT UNLOCK; -
The following example requires SSL on the user db_
mgr. ALTER USER 'db_mgr'@'localhost' REQUIRE SSL;
Manually Expire a User’s Password
You can expire a user's password using the following command:
ALTER USER 'username'@'host' PASSWORD EXPIRE;
To reactivate the password, use:
ALTER USER 'user'@'host' PASSWORD ACTIVATE;
If the user is logged in when the PASSWORD EXPIRE command is run, they can continue using the current session without interruption.password_ engine variable.
Refer to List of Engine Variables for more information on password_.
Refer to Configuring a Password Policy for details on how to configure a robust password policy.
Last modified: