Changes ClickHouse user accounts. Syntax:Documentation Index
Fetch the complete documentation index at: https://private-7c7dfe99-page-updates.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
ALTER USER you must have the ALTER USER privilege.
GRANTEES Clause
Specifies users or roles which are allowed to receive privileges from this user on the condition this user has also all required access granted with GRANT OPTION. Options of theGRANTEES clause:
user— Specifies a user this user can grant privileges to.role— Specifies a role this user can grant privileges to.ANY— This user can grant privileges to anyone. It’s the default setting.NONE— This user can grant privileges to none.
EXCEPT expression. For example, ALTER USER user1 GRANTEES ANY EXCEPT user2. It means if user1 has some privileges granted with GRANT OPTION it will be able to grant those privileges to anyone except user2.
Examples
Set assigned roles as default:role1 and role2:
john account to grant his privileges to the user with jack account:
- Older versions of ClickHouse might not support the syntax of multiple authentication methods. Therefore, if the ClickHouse server contains such users and is downgraded to a version that does not support it, such users will become unusable and some user related operations will be broken. In order to downgrade gracefully, one must set all users to contain a single authentication method prior to downgrading. Alternatively, if the server was downgraded without the proper procedure, the faulty users should be dropped.
no_passwordcan not co-exist with other authentication methods for security reasons. Because of that, it is not possible toADDano_passwordauthentication method. The below query will throw an error:
no_password, you must specify in the below replacing form.
Reset authentication methods and adds the ones specified in the query (effect of leading IDENTIFIED without the ADD keyword):
VALID UNTIL Clause
Allows you to specify the expiration date and, optionally, the time for an authentication method. It accepts a string as a parameter. It is recommended to use theYYYY-MM-DD [hh:mm:ss] [timezone] format for datetime. By default, this parameter equals 'infinity'.
The VALID UNTIL clause can only be specified along with an authentication method, except for the case where no authentication method has been specified in the query. In this scenario, the VALID UNTIL clause will be applied to all existing authentication methods.
Examples:
ALTER USER name1 VALID UNTIL '2025-01-01'ALTER USER name1 VALID UNTIL '2025-01-01 12:00:00 UTC'ALTER USER name1 VALID UNTIL 'infinity'ALTER USER name1 IDENTIFIED WITH plaintext_password BY 'no_expiration', bcrypt_password BY 'expiration_set' VALID UNTIL'2025-01-01''