<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="error-lost-connection">
      </a>
      B.3.2.3 Lost connection to MySQL server
     </h4>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045054471168">
  </a>
  <a class="indexterm" name="idm46045054469712">
  </a>
  <a class="indexterm" name="idm46045054468224">
  </a>
  <p>
   There are three likely causes for this error message.
  </p>
  <p>
   Usually it indicates network connectivity trouble and you
          should check the condition of your network if this error
          occurs frequently. If the error message includes
   <span class="quote">
    “
    <span class="quote">
     during
          query,
    </span>
    ”
   </span>
   this is probably the case you are experiencing.
  </p>
  <p>
   Sometimes the
   <span class="quote">
    “
    <span class="quote">
     during query
    </span>
    ”
   </span>
   form happens when
          millions of rows are being sent as part of one or more
          queries. If you know that this is happening, you should try
          increasing
   <a class="link" href="server-system-variables.html#sysvar_net_read_timeout">
    <code class="literal">
     net_read_timeout
    </code>
   </a>
   from its default of 30 seconds to 60 seconds or longer,
          sufficient for the data transfer to complete.
  </p>
  <p>
   More rarely, it can happen when the client is attempting the
          initial connection to the server. In this case, if your
   <a class="link" href="server-system-variables.html#sysvar_connect_timeout">
    <code class="literal">
     connect_timeout
    </code>
   </a>
   value is set
          to only a few seconds, you may be able to resolve the problem
          by increasing it to ten seconds, perhaps more if you have a
          very long distance or slow connection. You can determine
          whether you are experiencing this more uncommon cause by using
   <code class="literal">
    SHOW GLOBAL STATUS LIKE 'Aborted_connects'
   </code>
   .
          It increases by one for each initial connection attempt that
          the server aborts. You may see
   <span class="quote">
    “
    <span class="quote">
     reading authorization
          packet
    </span>
    ”
   </span>
   as part of the error message; if so, that also
          suggests that this is the solution that you need.
  </p>
  <p>
   If the cause is none of those just described, you may be
          experiencing a problem with
   <a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
    <code class="literal">
     BLOB
    </code>
   </a>
   values that are larger
          than
   <a class="link" href="server-system-variables.html#sysvar_max_allowed_packet">
    <code class="literal">
     max_allowed_packet
    </code>
   </a>
   ,
          which can cause this error with some clients. Sometime you may
          see an
   <a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_net_packet_too_large" target="_top">
    <code class="literal">
     ER_NET_PACKET_TOO_LARGE
    </code>
   </a>
   error, and that confirms that you need to increase
   <a class="link" href="server-system-variables.html#sysvar_max_allowed_packet">
    <code class="literal">
     max_allowed_packet
    </code>
   </a>
   .
  </p>
 </div>
 <br/>
</div>
