Skip to main content
SHOW CREATE USER returns the CREATE USER statement that reproduces a user, including its authentication method, default roles, account state, and properties. The statement reflects the current state of the user. Changes made by ALTER USER or SET PASSWORD after the user was created are included. Tip All users can run this statement against themselves. Viewing another user requires the user_admin role or the GRANT privilege on SYSTEM. The password digest is returned only to users that hold the SHOW SECRET privilege on SYSTEM. Otherwise it is masked as <secret>. This applies to your own user as well.

Syntax

Parameters

Output

Clauses are emitted only when they differ from the default: Note Two caveats apply to the emitted statement:
  • User properties are stored per user name rather than per user identity. 'jack'@'192.168.%' and 'jack'@'10.1.%' therefore return the same PROPERTIES clause.
  • If a password policy applies to the user, through either the PASSWORD_POLICY property or a cluster-wide policy, the emitted statement cannot be replayed as it stands. IDENTIFIED WITH ... AS supplies a password digest, and a password policy can only validate a plaintext password, so CREATE USER rejects it with Because the Password Policy is in effect, you cannot use a hashed password. Recreate such a user with a plaintext password instead.

Examples

Create a user and grant it a default role.
Example 1: Display the user as a holder of the SHOW SECRET privilege.
Example 2: Display the same user without the SHOW SECRET privilege.
Example 3: Display the current user. A user with no password, no default role, and only default properties yields a single-line statement.
Example 4: Grant the SHOW SECRET privilege so that a user can read password digests.

References