<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="native-pluggable-authentication">
      </a>
      8.4.1.1 Native Pluggable Authentication
     </h4>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045246352832">
  </a>
  <a class="indexterm" name="idm46045246351728">
  </a>
  <p>
   MySQL includes a
   <code class="literal">
    mysql_native_password
   </code>
   plugin
        that implements native authentication; that is, authentication
        based on the password hashing method in use from before the
        introduction of pluggable authentication.
  </p>
  <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
   <div class="admon-title">
    Note
   </div>
   <p>
    The
    <code class="literal">
     mysql_native_password
    </code>
    authentication
          plugin is deprecated as of MySQL 8.0.34, disabled by default
          in MySQL 8.4, and removed as of MySQL 9.0.0.
   </p>
  </div>
  <p>
   The following table shows the plugin names on the server and
        client sides.
  </p>
  <div class="table">
   <a name="idm46045246346752">
   </a>
   <p class="title">
    <b>
     Table 8.14 Plugin and Library Names for Native Password Authentication
    </b>
   </p>
   <div class="table-contents">
    <table summary="Names for the plugins and library file used for native password authentication.">
     <colgroup>
      <col style="width: 30%"/>
      <col style="width: 70%"/>
     </colgroup>
     <thead>
      <tr>
       <th>
        Plugin or File
       </th>
       <th>
        Plugin or File Name
       </th>
      </tr>
     </thead>
     <tbody>
      <tr>
       <td>
        Server-side plugin
       </td>
       <td>
        <code class="literal">
         mysql_native_password
        </code>
       </td>
      </tr>
      <tr>
       <td>
        Client-side plugin
       </td>
       <td>
        <code class="literal">
         mysql_native_password
        </code>
       </td>
      </tr>
      <tr>
       <td>
        Library file
       </td>
       <td>
        None (plugins are built in)
       </td>
      </tr>
     </tbody>
    </table>
   </div>
  </div>
  <br class="table-break"/>
  <p>
   The following sections provide installation and usage
        information specific to native pluggable authentication:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <a class="xref" href="native-pluggable-authentication.html#native-pluggable-authentication-installation" title="Installing Native Pluggable Authentication">
       Installing Native Pluggable Authentication
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="xref" href="native-pluggable-authentication.html#native-pluggable-authentication-usage" title="Using Native Pluggable Authentication">
       Using Native Pluggable Authentication
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="xref" href="native-pluggable-authentication.html#native-pluggable-authentication-disable" title="Disabling Native Pluggable Authentication">
       Disabling Native Pluggable Authentication
      </a>
     </p>
    </li>
   </ul>
  </div>
  <p>
   For general information about pluggable authentication in MySQL,
        see
   <a class="xref" href="pluggable-authentication.html" title="8.2.17 Pluggable Authentication">
    Section 8.2.17, “Pluggable Authentication”
   </a>
   .
  </p>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="native-pluggable-authentication-installation">
       </a>
       Installing Native Pluggable Authentication
      </h5>
     </div>
    </div>
   </div>
   <p>
    The
    <code class="literal">
     mysql_native_password
    </code>
    plugin exists in
          server and client forms:
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       The server-side plugin is built into the server, but is
              disabled by default. To enable it, start the MySQL Server
              with
       <a class="link" href="server-options.html#option_mysqld_mysql-native-password">
        <code class="option">
         --mysql-native-password=ON
        </code>
       </a>
       or by including
       <code class="literal">
        mysql_native_password=ON
       </code>
       in the
       <code class="literal">
        [mysqld]
       </code>
       section of your MySQL
              configuration file.
      </p>
     </li>
     <li class="listitem">
      <p>
       The client-side plugin is built into the
       <code class="literal">
        libmysqlclient
       </code>
       client library and is
              available to any program linked against
       <code class="literal">
        libmysqlclient
       </code>
       .
      </p>
     </li>
    </ul>
   </div>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="native-pluggable-authentication-usage">
       </a>
       Using Native Pluggable Authentication
      </h5>
     </div>
    </div>
   </div>
   <p>
    MySQL client programs in MySQL 8.4 (and later)
          use
    <code class="literal">
     caching_sha2_password
    </code>
    for
          authentication by default. Use the
    <a class="link" href="mysql-command-options.html#option_mysql_default-auth">
     <code class="option">
      --default-auth
     </code>
    </a>
    option to set
    <code class="literal">
     mysql_native_password
    </code>
    as the default
          client-side authentication plugin, if that is what is desired,
          like this:
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa32058230"><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-terminal"><span class="token prompt">$&gt; </span><span class="token command">mysql</span> <span class="token constant">--default-auth</span><span class="token attr-value"><span class="token punctuation">=</span>mysql_native_password</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span></code></pre>
   </div>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="native-pluggable-authentication-disable">
       </a>
       Disabling Native Pluggable Authentication
      </h5>
     </div>
    </div>
   </div>
   <p>
    In MySQL 8.4, the
    <code class="literal">
     mysql_native_password
    </code>
    server-side plugin is
          disabled by default. To keep it disabled, be sure the server
          is started without specifying the
    <a class="link" href="server-options.html#option_mysqld_mysql-native-password">
     <code class="option">
      --mysql-native-password
     </code>
    </a>
    option.
          Using
    <code class="option">
     --mysql-native-password=OFF
    </code>
    also works
          for this purpose, but is not required. In addition, do not
          enable
    <code class="literal">
     mysql_native_password
    </code>
    in your MySQL
          configuration file to keep it disabled.
   </p>
   <p>
    When the plugin is disabled, all of the operations that depend
          on the plugin are inaccessible. Specifically:
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       Defined user accounts that authenticate with
       <code class="literal">
        mysql_native_password
       </code>
       encounter an
              error when they attempt to connect.
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa70983884"><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-terminal"><span class="token prompt">$&gt; </span><span class="token command">MYSQL</span> <span class="token property">-u</span> userx <span class="token property">-p</span>
<span class="token output">ERROR 1045 (28000)<span class="token punctuation">:</span> Access denied for user 'userx'@'localhost' (using password<span class="token punctuation">:</span> NO)</span></code></pre>
      </div>
      <p>
       The server writes these errors to the server log.
      </p>
     </li>
     <li class="listitem">
      <p>
       Attempts to create a new user account or to alter an
              existing user account identified with
       <code class="literal">
        mysql_native_password
       </code>
       also fail and
              emit an error.
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa87460414"><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> userxx<span class="token variable">@localhost</span> <span class="token keyword">IDENTIFIED</span> <span class="token keyword">WITH</span> <span class="token string">'mysql_native_password'</span><span class="token punctuation">;</span>
<span class="token output">ERROR 1524 (HY000)<span class="token punctuation">:</span> Plugin 'mysql_native_password' is not loaded</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">ALTER</span> <span class="token keyword">USER</span> userxy<span class="token variable">@localhost</span> <span class="token keyword">IDENTIFIED</span> <span class="token keyword">WITH</span> <span class="token string">'mysql_native_password'</span><span class="token punctuation">;</span>
<span class="token output">ERROR 1524 (HY000)<span class="token punctuation">:</span> Plugin 'mysql_native_password' is not loaded</span></code></pre>
      </div>
     </li>
    </ul>
   </div>
   <p>
    For instructions on enabling the plugin, see
    <a class="xref" href="native-pluggable-authentication.html#native-pluggable-authentication-installation" title="Installing Native Pluggable Authentication">
     Installing Native Pluggable Authentication
    </a>
    .
   </p>
  </div>
 </div>
 <br/>
</div>
