Skip to main content

SET PASSWORD

Description​

Use SET PASSWORD to change the login password for a warehouse SQL account.

Syntax​

SET PASSWORD [FOR <user_identity>] =
{ PASSWORD(<plain_password>) | <hashed_password> }

Required parameters​

Specify either a plaintext password or a password hash, not both.

1. <plain_password>

Pass the new plaintext password as a quoted string to PASSWORD().

2. <hashed_password>

Pass an existing password hash as a quoted string, without wrapping it in PASSWORD(). Use a hash in the format returned by PASSWORD().

Optional parameters​

1. <user_identity>

Use the exact username and host defined for the warehouse SQL account, for example 'jack'@'192.%'. If you omit FOR, the statement changes the password for the authenticated account returned by CURRENT_USER(). To check that identity, run SELECT CURRENT_USER();.

Access control requirements​

You can change your own password without additional SQL privileges. Changing another account's password requires global GRANT_PRIV or ADMIN_PRIV. Only 'root'@'%' can change the password for that exact account.

Usage notes​

VeloDB Core 26.1.4 replaces the account's built-in password when you run this statement. It does not accept a RETAIN CURRENT PASSWORD clause. Update applications that use the warehouse SQL account when you rotate its password.

Example​

Run only one statement for each password change. Replace <new_password> with a strong plaintext password or <password_hash> with a precomputed hash in the format returned by PASSWORD().

  • Change your own password.
SET PASSWORD = PASSWORD('<new_password>');
SET PASSWORD = '<password_hash>';
  • Change a specified user's password. Replace the example account identity with the one created for that user.
SET PASSWORD FOR 'jack'@'192.%' = PASSWORD('<new_password>');
SET PASSWORD FOR 'jack'@['domain'] = '<password_hash>';

Enter to send · Shift+Enter for a new line