SHOW CREATE USER

This statement shows how to re-create a user using the CREATE USER syntax.

Synopsis

ShowCreateUserStmt:

ShowCreateUserStmt

Username:

Username

Examples

  1. mysql> SHOW CREATE USER 'root';
  2. +--------------------------------------------------------------------------------------------------------------------------+
  3. | CREATE USER for root@% |
  4. +--------------------------------------------------------------------------------------------------------------------------+
  5. | CREATE USER 'root'@'%' IDENTIFIED WITH 'mysql_native_password' AS '' REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK |
  6. +--------------------------------------------------------------------------------------------------------------------------+
  7. 1 row in set (0.00 sec)
  8. mysql> SHOW GRANTS FOR 'root';
  9. +-------------------------------------------+
  10. | Grants for root@% |
  11. +-------------------------------------------+
  12. | GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' |
  13. +-------------------------------------------+
  14. 1 row in set (0.00 sec)

MySQL compatibility

  • The output of SHOW CREATE USER is designed to match MySQL, but several of the CREATE options are not yet supported by TiDB. Not yet supported options will be parsed but ignored. See [security compatibility] for more details.

See also