<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h3 class="title">
      <a name="reusing-ssl-sessions">
      </a>
      8.3.5 Reusing SSL Sessions
     </h3>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045246476928">
  </a>
  <a class="indexterm" name="idm46045246475440">
  </a>
  <p>
   MySQL client programs may elect to resume a prior SSL session,
      provided that the server has the session in its runtime cache.
      This section describes the conditions that are favorable for SSL
      session reuse, the server variables used for managing and
      monitoring the session cache, and the client command-line options
      for storing and reusing session data.
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <a class="xref" href="reusing-ssl-sessions.html#ssl-session-cache-server-configuration" title="Server-Side Runtime Configuration and Monitoring for SSL Session Reuse">
       Server-Side Runtime Configuration and Monitoring for SSL Session Reuse
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="xref" href="reusing-ssl-sessions.html#ssl-session-data-client-configuration" title="Client-Side Configuration for SSL Session Reuse">
       Client-Side Configuration for SSL Session Reuse
      </a>
     </p>
    </li>
   </ul>
  </div>
  <p>
   Each full TLS exchange can be costly both in terms of computation
      and network overhead, less costly if TLSv1.3 is used. By
      extracting a session ticket from an established session and then
      submitting that ticket while establishing the next connection, the
      overall cost is reduced if the session can be reused. For example,
      consider the benefit of having web pages that can open multiple
      connections and generate faster.
  </p>
  <p>
   In general, the following conditions must be satisfied before SSL
      sessions can be reused:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      The server must keep its session cache in memory.
     </p>
    </li>
    <li class="listitem">
     <p>
      The server-side session cache timeout must not have expired.
     </p>
    </li>
    <li class="listitem">
     <p>
      Each client has to maintain a cache of active sessions and
          keep it secure.
     </p>
    </li>
   </ul>
  </div>
  <p>
   C applications can use the C API capabilities to enable session
      reuse for encrypted connections (see
   <a class="ulink" href="/doc/c-api/8.4/en/c-api-ssl-session-reuse.html" target="_top">
    SSL Session Reuse
   </a>
   ).
  </p>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h4 class="title">
       <a name="ssl-session-cache-server-configuration">
       </a>
       Server-Side Runtime Configuration and Monitoring for SSL Session Reuse
      </h4>
     </div>
    </div>
   </div>
   <p>
    To create the initial TLS context, the server uses the values
        that the context-related system variables have at startup. To
        expose the context values, the server also initializes a set of
        corresponding status variables. The following table shows the
        system variables that define the server's runtime session cache
        and the corresponding status variables that expose the currently
        active session-cache values.
   </p>
   <div class="table">
    <a name="ssl-session-cache-variables-table">
    </a>
    <p class="title">
     <b>
      Table 8.13 System and Status Variables for Session Reuse
     </b>
    </p>
    <div class="table-contents">
     <table summary="The system variables that define caching for session reuse and the corresponding status variables that expose active session-cache values.">
      <colgroup>
       <col style="width: 45%"/>
       <col style="width: 55%"/>
      </colgroup>
      <thead>
       <tr>
        <th>
         System Variable Name
        </th>
        <th>
         Corresponding Status Variable Name
        </th>
       </tr>
      </thead>
      <tbody>
       <tr>
        <td>
         <a class="link" href="server-system-variables.html#sysvar_ssl_session_cache_mode">
          <code class="literal">
           ssl_session_cache_mode
          </code>
         </a>
        </td>
        <td>
         <a class="link" href="server-status-variables.html#statvar_Ssl_session_cache_mode">
          <code class="literal">
           Ssl_session_cache_mode
          </code>
         </a>
        </td>
       </tr>
       <tr>
        <td>
         <a class="link" href="server-system-variables.html#sysvar_ssl_session_cache_timeout">
          <code class="literal">
           ssl_session_cache_timeout
          </code>
         </a>
        </td>
        <td>
         <a class="link" href="server-status-variables.html#statvar_Ssl_session_cache_timeout">
          <code class="literal">
           Ssl_session_cache_timeout
          </code>
         </a>
        </td>
       </tr>
      </tbody>
     </table>
    </div>
   </div>
   <br class="table-break"/>
   <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
    <div class="admon-title">
     Note
    </div>
    <p>
     When the value of the
     <a class="link" href="server-system-variables.html#sysvar_ssl_session_cache_mode">
      <code class="literal">
       ssl_session_cache_mode
      </code>
     </a>
     server
          variable is
     <code class="literal">
      ON
     </code>
     , which is the default mode,
          the value of the
     <a class="link" href="server-status-variables.html#statvar_Ssl_session_cache_mode">
      <code class="literal">
       Ssl_session_cache_mode
      </code>
     </a>
     status variable is
     <code class="literal">
      SERVER
     </code>
     .
    </p>
   </div>
   <p>
    SSL session cache variables apply to both the
    <code class="literal">
     mysql_main
    </code>
    and
    <code class="literal">
     mysql_admin
    </code>
    TLS channels. Their values are also exposed as properties in the
        Performance Schema
    <a class="link" href="performance-schema-tls-channel-status-table.html" title="29.12.22.9 The tls_channel_status Table">
     <code class="literal">
      tls_channel_status
     </code>
    </a>
    table, along
        with the properties for any other active TLS contexts.
   </p>
   <p>
    To reconfigure the SSL session cache at runtime, use this
        procedure:
   </p>
   <div class="orderedlist">
    <ol class="orderedlist" type="1">
     <li class="listitem">
      <p>
       Set each cache-related system variable that should be
            changed to its new value. For example, change the cache
            timeout value from the default (300 seconds) to 600 seconds:
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa8339014"><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">SET</span> <span class="token keyword">GLOBAL</span> ssl_session_cache_timeout <span class="token operator">=</span> <span class="token number">600</span><span class="token punctuation">;</span></code></pre>
      </div>
      <p>
       The members of each pair of system and status variables may
            have different values temporarily due to the way the
            reconfiguration procedure works.
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa16517094"><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">SHOW</span> <span class="token keyword">VARIABLES</span> <span class="token operator">LIKE</span> <span class="token string">'ssl_session_cache_timeout'</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 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>
<span class="token output"><span class="token punctuation">|</span> Variable_name             <span class="token punctuation">|</span> Value <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 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>
<span class="token output"><span class="token punctuation">|</span> ssl_session_cache_timeout <span class="token punctuation">|</span> 600   <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 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>
<span class="token output">1 row in set (0.00 sec)</span>

<span class="token prompt">mysql&gt;</span> <span class="token keyword">SHOW</span> <span class="token keyword">STATUS</span> <span class="token operator">LIKE</span> <span class="token string">'Ssl_session_cache_timeout'</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 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>
<span class="token output"><span class="token punctuation">|</span> Variable_name             <span class="token punctuation">|</span> Value <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 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>
<span class="token output"><span class="token punctuation">|</span> Ssl_session_cache_timeout <span class="token punctuation">|</span> 300   <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 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>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
      </div>
      <p>
       For additional information about setting variable values,
            see
       <a class="xref" href="set-variable.html#set-variable-system-variables" title="System Variable Assignment">
        System Variable Assignment
       </a>
       .
      </p>
     </li>
     <li class="listitem">
      <p>
       Execute
       <a class="link" href="alter-instance.html#alter-instance-reload-tls">
        <code class="literal">
         ALTER INSTANCE RELOAD
            TLS
        </code>
       </a>
       . This statement reconfigures the active TLS
            context from the current values of the cache-related system
            variables. It also sets the cache-related status variables
            to reflect the new active cache values. The statement
            requires the
       <a class="link" href="privileges-provided.html#priv_connection-admin">
        <code class="literal">
         CONNECTION_ADMIN
        </code>
       </a>
       privilege.
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa97717974"><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">ALTER</span> <span class="token keyword">INSTANCE</span> <span class="token keyword">RELOAD</span> <span class="token keyword">TLS</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.01 sec)</span>
  
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SHOW</span> <span class="token keyword">VARIABLES</span> <span class="token operator">LIKE</span> <span class="token string">'ssl_session_cache_timeout'</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 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>
<span class="token output"><span class="token punctuation">|</span> Variable_name             <span class="token punctuation">|</span> Value <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 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>
<span class="token output"><span class="token punctuation">|</span> ssl_session_cache_timeout <span class="token punctuation">|</span> 600   <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 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>
<span class="token output">1 row in set (0.00 sec)</span>

<span class="token prompt">mysql&gt;</span> <span class="token keyword">SHOW</span> <span class="token keyword">STATUS</span> <span class="token operator">LIKE</span> <span class="token string">'Ssl_session_cache_timeout'</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 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>
<span class="token output"><span class="token punctuation">|</span> Variable_name             <span class="token punctuation">|</span> Value <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 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>
<span class="token output"><span class="token punctuation">|</span> Ssl_session_cache_timeout <span class="token punctuation">|</span> 600   <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 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>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
      </div>
      <p>
       New connections established after execution of
       <a class="link" href="alter-instance.html#alter-instance-reload-tls">
        <code class="literal">
         ALTER INSTANCE RELOAD TLS
        </code>
       </a>
       use
            the new TLS context. Existing connections remain unaffected.
      </p>
     </li>
    </ol>
   </div>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h4 class="title">
       <a name="ssl-session-data-client-configuration">
       </a>
       Client-Side Configuration for SSL Session Reuse
      </h4>
     </div>
    </div>
   </div>
   <p>
    All MySQL client programs are capable of reusing a prior session
        for new encrypted connections made to the same server, provided
        that you stored the session data while the original connection
        was still active. Session data are stored to a file and you
        specify this file when you invoke the client again.
   </p>
   <p>
    To store and reuse SSL session data, use this procedure:
   </p>
   <div class="orderedlist">
    <ol class="orderedlist" type="1">
     <li class="listitem">
      <p>
       Invoke
       <a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
        <span class="command">
         <strong>
          mysql
         </strong>
        </span>
       </a>
       to establish an encrypted
            connection to a server running MySQL 8.4.
      </p>
     </li>
     <li class="listitem">
      <p>
       Use the
       <span class="command">
        <strong>
         ssl_session_data_print
        </strong>
       </span>
       command to
            specify the path to a file where you can store the currently
            active session data securely. For example:
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa95387962"><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> ssl_session_data_print <span class="token operator">~</span><span class="token operator">/</span>private<span class="token operator">-</span>dir<span class="token operator">/</span><span class="token keyword">session</span><span class="token punctuation">.</span>txt</code></pre>
      </div>
      <p>
       Session data are obtained in the form of a null-terminated,
            PEM encoded ANSI string. If you omit the path and file name,
            the string prints to standard output.
      </p>
     </li>
     <li class="listitem">
      <p>
       From the prompt of your command interpreter, invoke any
            MySQL client program to establish a new encrypted connection
            to the same server. To reuse the session data, specify the
       <a class="link" href="connection-options.html#option_general_ssl-session-data">
        <code class="option">
         --ssl-session-data
        </code>
       </a>
       command-line option and the file argument.
      </p>
      <p>
       For example, establish a new connection using
       <a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
        <span class="command">
         <strong>
          mysql
         </strong>
        </span>
       </a>
       :
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa58041187"><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-simple">mysql <span class="token operator">-</span>u admin <span class="token operator">-</span>p <span class="token operator">--</span>ssl<span class="token operator">-</span>session<span class="token operator">-</span>data<span class="token operator">=</span><span class="token operator">~</span><span class="token operator">/</span>private<span class="token operator">-</span>dir<span class="token operator">/</span>session<span class="token punctuation">.</span>txt</code></pre>
      </div>
      <p>
       and then
       <a class="link" href="mysqlshow.html" title="6.5.6 mysqlshow — Display Database, Table, and Column Information">
        <span class="command">
         <strong>
          mysqlshow
         </strong>
        </span>
       </a>
       client:
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-simple"><div class="docs-select-all right" id="sa3344291"><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-simple">mysqlshow <span class="token operator">-</span>u admin <span class="token operator">-</span>p <span class="token operator">--</span>ssl<span class="token operator">-</span>session<span class="token operator">-</span>data<span class="token operator">=</span><span class="token operator">~</span><span class="token operator">/</span>private<span class="token operator">-</span>dir<span class="token operator">/</span>session<span class="token punctuation">.</span>txt
Enter password<span class="token operator">:</span> <span class="token operator">**</span><span class="token operator">**</span><span class="token operator">*</span>
<span class="token operator">+</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">+</span>
<span class="token operator">|</span>     Databases      <span class="token operator">|</span>
<span class="token operator">+</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">+</span>
<span class="token operator">|</span> information_schema <span class="token operator">|</span>
<span class="token operator">|</span> mysql              <span class="token operator">|</span>
<span class="token operator">|</span> performance_schema <span class="token operator">|</span>
<span class="token operator">|</span> sys                <span class="token operator">|</span>
<span class="token operator">|</span> world              <span class="token operator">|</span>
<span class="token operator">+</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">+</span></code></pre>
      </div>
      <p>
       In each example, the client attempts to resume the original
            session while it establishes a new connection to the same
            server.
      </p>
      <p>
       To confirm whether
       <a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
        <span class="command">
         <strong>
          mysql
         </strong>
        </span>
       </a>
       reused a
            session, see the output from the
       <code class="literal">
        status
       </code>
       command. If the currently active
       <a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
        <span class="command">
         <strong>
          mysql
         </strong>
        </span>
       </a>
       connection did resume the session, the status information
            includes
       <code class="literal">
        SSL session reused: true
       </code>
       .
      </p>
     </li>
    </ol>
   </div>
   <p>
    In addition to
    <a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
     <span class="command">
      <strong>
       mysql
      </strong>
     </span>
    </a>
    and
    <a class="link" href="mysqlshow.html" title="6.5.6 mysqlshow — Display Database, Table, and Column Information">
     <span class="command">
      <strong>
       mysqlshow
      </strong>
     </span>
    </a>
    , SSL session reuse applies to
    <a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
     <span class="command">
      <strong>
       mysqladmin
      </strong>
     </span>
    </a>
    ,
    <a class="link" href="mysqlbinlog.html" title="6.6.9 mysqlbinlog — Utility for Processing Binary Log Files">
     <span class="command">
      <strong>
       mysqlbinlog
      </strong>
     </span>
    </a>
    ,
    <a class="link" href="mysqlcheck.html" title="6.5.3 mysqlcheck — A Table Maintenance Program">
     <span class="command">
      <strong>
       mysqlcheck
      </strong>
     </span>
    </a>
    ,
    <a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
     <span class="command">
      <strong>
       mysqldump
      </strong>
     </span>
    </a>
    ,
    <a class="link" href="mysqlimport.html" title="6.5.5 mysqlimport — A Data Import Program">
     <span class="command">
      <strong>
       mysqlimport
      </strong>
     </span>
    </a>
    ,
    <a class="link" href="mysqlslap.html" title="6.5.7 mysqlslap — A Load Emulation Client">
     <span class="command">
      <strong>
       mysqlslap
      </strong>
     </span>
    </a>
    ,
    <span class="command">
     <strong>
      mysqltest
     </strong>
    </span>
    ,
    <a class="link" href="mysql-migrate-keyring.html" title="6.6.8 mysql_migrate_keyring — Keyring Key Migration Utility">
     <span class="command">
      <strong>
       mysql_migrate_keyring
      </strong>
     </span>
    </a>
    , and
    <a class="link" href="mysql-secure-installation.html" title="6.4.2 mysql_secure_installation — Improve MySQL Installation Security">
     <span class="command">
      <strong>
       mysql_secure_installation
      </strong>
     </span>
    </a>
    .
   </p>
   <p>
    Several conditions may prevent the successful retrieval of
        session data. For instance, if the session is not fully
        connected, it is not an SSL session, the server has not yet sent
        the session data, or the SSL session is simply not reusable.
        Even with properly stored session data, the server's session
        cache can time out. Regardless of the cause, an error is
        returned by default if you specify
    <a class="link" href="connection-options.html#option_general_ssl-session-data">
     <code class="option">
      --ssl-session-data
     </code>
    </a>
    but the
        session cannot be reused. For example:
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting language-simple"><div class="docs-select-all right" id="sa27245484"><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-simple">mysqlshow <span class="token operator">-</span>u admin <span class="token operator">-</span>p <span class="token operator">--</span>ssl<span class="token operator">-</span>session<span class="token operator">-</span>data<span class="token operator">=</span><span class="token operator">~</span><span class="token operator">/</span>private<span class="token operator">-</span>dir<span class="token operator">/</span>session<span class="token punctuation">.</span>txt
Enter password<span class="token operator">:</span> <span class="token operator">**</span><span class="token operator">**</span><span class="token operator">*</span>
ERROR<span class="token operator">:</span>
<span class="token operator">--</span>ssl<span class="token operator">-</span>session<span class="token operator">-</span>data specified but the session was not reused<span class="token punctuation">.</span></code></pre>
   </div>
   <p>
    To suppress the error message, and to establish the connection
        by silently creating a new session instead, specify
    <a class="link" href="connection-options.html#option_general_ssl-session-data-continue-on-failed-reuse">
     <code class="option">
      --ssl-session-data-continue-on-failed-reuse
     </code>
    </a>
    on the command line, along with
    <a class="link" href="connection-options.html#option_general_ssl-session-data">
     <code class="option">
      --ssl-session-data
     </code>
    </a>
    . If the
        server's cache timeout has expired, you can store the session
        data again to the same file. The default server cache timeout
        can be extended (see
    <a class="xref" href="reusing-ssl-sessions.html#ssl-session-cache-server-configuration" title="Server-Side Runtime Configuration and Monitoring for SSL Session Reuse">
     Server-Side Runtime Configuration and Monitoring for SSL Session Reuse
    </a>
    ).
   </p>
  </div>
 </div>
 <br/>
</div>
