<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h3 class="title">
      <a name="information-schema-user-attributes-table">
      </a>
      28.3.45 The INFORMATION_SCHEMA USER_ATTRIBUTES Table
     </h3>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045078103008">
  </a>
  <p>
   The
   <a class="link" href="information-schema-user-attributes-table.html" title="28.3.45 The INFORMATION_SCHEMA USER_ATTRIBUTES Table">
    <code class="literal">
     USER_ATTRIBUTES
    </code>
   </a>
   table provides
      information about user comments and user attributes. It takes its
      values from the
   <code class="literal">
    mysql.user
   </code>
   system table.
  </p>
  <p>
   The
   <a class="link" href="information-schema-user-attributes-table.html" title="28.3.45 The INFORMATION_SCHEMA USER_ATTRIBUTES Table">
    <code class="literal">
     USER_ATTRIBUTES
    </code>
   </a>
   table has these
      columns:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <code class="literal">
       USER
      </code>
     </p>
     <p>
      The user name portion of the account to which the
      <code class="literal">
       ATTRIBUTE
      </code>
      column value applies.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       HOST
      </code>
     </p>
     <p>
      The host name portion of the account to which the
      <code class="literal">
       ATTRIBUTE
      </code>
      column value applies.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       ATTRIBUTE
      </code>
     </p>
     <p>
      The user comment, user attribute, or both belonging to the
          account specified by the
      <code class="literal">
       USER
      </code>
      and
      <code class="literal">
       HOST
      </code>
      columns. The value is in JSON object
          notation. Attributes are shown exactly as set using
      <a class="link" href="create-user.html" title="15.7.1.3 CREATE USER Statement">
       <code class="literal">
        CREATE
          USER
       </code>
      </a>
      and
      <a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
       <code class="literal">
        ALTER
          USER
       </code>
      </a>
      statements with
      <code class="literal">
       ATTRIBUTE
      </code>
      or
      <code class="literal">
       COMMENT
      </code>
      options. A comment is shown as a
          key-value pair having
      <code class="literal">
       comment
      </code>
      as the key.
          For additional information and examples, see
      <a class="xref" href="create-user.html#create-user-comments-attributes" title="CREATE USER Comment and Attribute Options">
       CREATE USER Comment and Attribute Options
      </a>
      .
     </p>
    </li>
   </ul>
  </div>
  <h4>
   <a name="idm46045078082496">
   </a>
   Notes
  </h4>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <a class="link" href="information-schema-user-attributes-table.html" title="28.3.45 The INFORMATION_SCHEMA USER_ATTRIBUTES Table">
       <code class="literal">
        USER_ATTRIBUTES
       </code>
      </a>
      is a nonstandard
      <code class="literal">
       INFORMATION_SCHEMA
      </code>
      table.
     </p>
    </li>
    <li class="listitem">
     <p>
      To obtain only the user comment for a given user as an
          unquoted string, you can employ a query such as this one:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa60191377"><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">SELECT</span> <span class="token keyword">ATTRIBUTE</span><span class="token operator">-</span><span class="token operator">&gt;&gt;</span><span class="token string">"$.comment"</span> <span class="token keyword">AS</span> <span class="token keyword">Comment</span>
<span class="token prompt">    -&gt;</span>     <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span>USER_ATTRIBUTES
<span class="token prompt">    -&gt;</span>     <span class="token keyword">WHERE</span> <span class="token keyword">USER</span><span class="token operator">=</span><span class="token string">'bill'</span> <span class="token operator">AND</span> <span class="token keyword">HOST</span><span class="token operator">=</span><span class="token string">'localhost'</span><span class="token punctuation">;</span>
<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>
<span class="token output"><span class="token punctuation">|</span> Comment   <span class="token punctuation">|</span></span>
<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>
<span class="token output"><span class="token punctuation">|</span> A comment <span class="token punctuation">|</span></span>
<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></code></pre>
     </div>
     <p>
      Similarly, you can obtain the unquoted value for a given user
          attribute using its key.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="information-schema-user-attributes-table.html" title="28.3.45 The INFORMATION_SCHEMA USER_ATTRIBUTES Table">
       <code class="literal">
        USER_ATTRIBUTES
       </code>
      </a>
      contents are
          accessible as follows:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         All rows are accessible if:
        </p>
        <div class="itemizedlist">
         <ul class="itemizedlist" style="list-style-type: square; ">
          <li class="listitem">
           <p>
            The current thread is a replica thread.
           </p>
          </li>
          <li class="listitem">
           <p>
            The access control system has not been initialized
                  (for example, the server was started with the
            <a class="link" href="server-options.html#option_mysqld_skip-grant-tables">
             <code class="option">
              --skip-grant-tables
             </code>
            </a>
            option).
           </p>
          </li>
          <li class="listitem">
           <p>
            The currently authenticated account has the
            <a class="link" href="privileges-provided.html#priv_update">
             <code class="literal">
              UPDATE
             </code>
            </a>
            or
            <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.
           </p>
          </li>
          <li class="listitem">
           <p>
            The currently authenticated account has the
            <a class="link" href="privileges-provided.html#priv_create-user">
             <code class="literal">
              CREATE USER
             </code>
            </a>
            and
            <a class="link" href="privileges-provided.html#priv_system-user">
             <code class="literal">
              SYSTEM_USER
             </code>
            </a>
            privileges.
           </p>
          </li>
         </ul>
        </div>
       </li>
       <li class="listitem">
        <p>
         Otherwise, the currently authenticated account can see the
              row for that account. Additionally, if the account has the
         <a class="link" href="privileges-provided.html#priv_create-user">
          <code class="literal">
           CREATE USER
          </code>
         </a>
         privilege but
              not the
         <a class="link" href="privileges-provided.html#priv_system-user">
          <code class="literal">
           SYSTEM_USER
          </code>
         </a>
         privilege, it can see rows for all other accounts that do
              not have the
         <a class="link" href="privileges-provided.html#priv_system-user">
          <code class="literal">
           SYSTEM_USER
          </code>
         </a>
         privilege.
        </p>
       </li>
      </ul>
     </div>
    </li>
   </ul>
  </div>
  <p>
   For more information about specifying account comments and
      attributes, see
   <a class="xref" href="create-user.html" title="15.7.1.3 CREATE USER Statement">
    Section 15.7.1.3, “CREATE USER Statement”
   </a>
   .
  </p>
 </div>
 <br/>
</div>
