Rechercher dans le manuel MySQL

13.7.6.12 SHOW CREATE USER Syntax

This statement shows the CREATE USER statement that creates the named user. An error occurs if the user does not exist. The statement requires the SELECT privilege for the mysql system database, except to see information for the current user. For the current user, the SELECT privilege for the mysql.user system table is required for display of the password hash in the IDENTIFIED AS clause; otherwise, the hash displays as <secret>.

To name the account, use the format described in Section 6.2.4, “Specifying Account Names”. The host name part of the account name, if omitted, defaults to '%'. It is also possible to specify CURRENT_USER or CURRENT_USER() to refer to the account associated with the current session.

Password hash values displayed in the IDENTIFIED WITH clause of output from SHOW CREATE USER may contain unprintable characters that have adverse effects on terminal displays and in other environments. Enabling the print_identified_with_as_hex system variable (available as of MySQL 8.0.17) causes SHOW CREATE USER to display such hash values as hexadecimal strings rather than as regular string literals. Hash values that do not contain unprintable characters still display as regular string literals, even with this variable enabled.

  1. mysql> CREATE USER 'u1'@'localhost' IDENTIFIED BY 'secret';
  2. mysql> SET print_identified_with_as_hex = ON;
  3. mysql> SHOW CREATE USER 'u1'@'localhost'\G
  4. *************************** 1. row ***************************
  5. CREATE USER for u1@localhost: CREATE USER 'u1'@'localhost'
  6. IDENTIFIED WITH 'caching_sha2_password'
  7. AS 0x244124303035240C7745603626313D613C4C10633E0A104B1E14135A544A7871567245614F4872344643546336546F624F6C7861326932752F45622F4F473273597557627139
  8. REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK

To display the privileges granted to an account, use the SHOW GRANTS statement. See Section 13.7.6.21, “SHOW GRANTS Syntax”.


Find a PHP function

Document created the 26/06/2006, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/mysql-rf-show-create-user.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.

References

  1. View the html document Language of the document:en Manuel MySQL : https://dev.mysql.com/

These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.

Contents Haut