<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="show-create-user">
      </a>
      15.7.7.13 SHOW CREATE USER Statement
     </h4>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045170799968">
  </a>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa62671369"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SHOW</span> <span class="token keyword">CREATE</span> <span class="token keyword">USER</span> <span class="token keyword"><em class="replaceable">user</em></span></code></pre>
  </div>
  <p>
   This statement shows the
   <a class="link" href="create-user.html" title="15.7.1.3 CREATE USER Statement">
    <code class="literal">
     CREATE
        USER
    </code>
   </a>
   statement that creates the named user. An error
        occurs if the user does not exist. The statement requires the
   <a class="link" href="privileges-provided.html#priv_select">
    <code class="literal">
     SELECT
    </code>
   </a>
   privilege for the
   <code class="literal">
    mysql
   </code>
   system schema, except to see
        information for the current user. For the current user, the
   <a class="link" href="privileges-provided.html#priv_select">
    <code class="literal">
     SELECT
    </code>
   </a>
   privilege for the
   <code class="literal">
    mysql.user
   </code>
   system table is required for
        display of the password hash in the
   <code class="literal">
    IDENTIFIED
        AS
   </code>
   clause; otherwise, the hash displays as
   <code class="literal">
    &lt;secret&gt;
   </code>
   .
  </p>
  <p>
   To name the account, use the format described in
   <a class="xref" href="account-names.html" title="8.2.4 Specifying Account Names">
    Section 8.2.4, “Specifying Account Names”
   </a>
   . The host name part of the
        account name, if omitted, defaults to
   <code class="literal">
    '%'
   </code>
   . It
        is also possible to specify
   <a class="link" href="information-functions.html#function_current-user">
    <code class="literal">
     CURRENT_USER
    </code>
   </a>
   or
   <a class="link" href="information-functions.html#function_current-user">
    <code class="literal">
     CURRENT_USER()
    </code>
   </a>
   to refer to the
        account associated with the current session.
  </p>
  <p>
   Password hash values displayed in the
   <code class="literal">
    IDENTIFIED
        WITH
   </code>
   clause of output from
   <a class="link" href="show-create-user.html" title="15.7.7.13 SHOW CREATE USER Statement">
    <code class="literal">
     SHOW
        CREATE USER
    </code>
   </a>
   may contain unprintable characters that
        have adverse effects on terminal displays and in other
        environments. Enabling the
   <a class="link" href="server-system-variables.html#sysvar_print_identified_with_as_hex">
    <code class="literal">
     print_identified_with_as_hex
    </code>
   </a>
   system variable causes
   <a class="link" href="show-create-user.html" title="15.7.7.13 SHOW CREATE USER Statement">
    <code class="literal">
     SHOW CREATE
        USER
    </code>
   </a>
   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.
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa18591970"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">CREATE</span> <span class="token keyword">USER</span> <span class="token string">'u1'</span>@<span class="token string">'localhost'</span> <span class="token keyword">IDENTIFIED</span> <span class="token keyword">BY</span> <span class="token string">'secret'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SET</span> print_identified_with_as_hex <span class="token operator">=</span> <span class="token keyword">ON</span><span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SHOW</span> <span class="token keyword">CREATE</span> <span class="token keyword">USER</span> <span class="token string">'u1'</span>@<span class="token string">'localhost'</span>\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
CREATE USER for u1@localhost<span class="token punctuation">:</span> CREATE USER `u1`@`localhost`
IDENTIFIED WITH 'caching_sha2_password'
AS 0x244124303035240C7745603626313D613C4C10633E0A104B1E14135A544A7871567245614F4872344643546336546F624F6C7861326932752F45622F4F473273597557627139
REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK
PASSWORD HISTORY DEFAULT PASSWORD REUSE INTERVAL DEFAULT
PASSWORD REQUIRE CURRENT DEFAULT</span></code></pre>
  </div>
  <p>
   To display the privileges granted to an account, use the
   <a class="link" href="show-grants.html" title="15.7.7.22 SHOW GRANTS Statement">
    <code class="literal">
     SHOW GRANTS
    </code>
   </a>
   statement. See
   <a class="xref" href="show-grants.html" title="15.7.7.22 SHOW GRANTS Statement">
    Section 15.7.7.22, “SHOW GRANTS Statement”
   </a>
   .
  </p>
 </div>
 <br/>
</div>
