<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h3 class="title">
      <a name="myisam-check">
      </a>
      9.6.2 How to Check MyISAM Tables for Errors
     </h3>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045230608608">
  </a>
  <a class="indexterm" name="idm46045230607152">
  </a>
  <a class="indexterm" name="idm46045230605664">
  </a>
  <p>
   To check a
   <code class="literal">
    MyISAM
   </code>
   table, use the following
        commands:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
       <span class="command">
        <strong>
         myisamchk
         <em class="replaceable">
          <code>
           tbl_name
          </code>
         </em>
        </strong>
       </span>
      </a>
     </p>
     <p>
      This finds 99.99% of all errors. What it cannot find is
            corruption that involves
      <span class="emphasis">
       <em>
        only
       </em>
      </span>
      the data
            file (which is very unusual). If you want to check a table,
            you should normally run
      <a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
       <span class="command">
        <strong>
         myisamchk
        </strong>
       </span>
      </a>
      without
            options or with the
      <code class="option">
       -s
      </code>
      (silent) option.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
       <span class="command">
        <strong>
         myisamchk -m
         <em class="replaceable">
          <code>
           tbl_name
          </code>
         </em>
        </strong>
       </span>
      </a>
     </p>
     <p>
      This finds 99.999% of all errors. It first checks all index
            entries for errors and then reads through all rows. It
            calculates a checksum for all key values in the rows and
            verifies that the checksum matches the checksum for the keys
            in the index tree.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
       <span class="command">
        <strong>
         myisamchk -e
         <em class="replaceable">
          <code>
           tbl_name
          </code>
         </em>
        </strong>
       </span>
      </a>
     </p>
     <p>
      This does a complete and thorough check of all data
            (
      <code class="option">
       -e
      </code>
      means
      <span class="quote">
       “
       <span class="quote">
        extended check
       </span>
       ”
      </span>
      ).
            It does a check-read of every key for each row to verify
            that they indeed point to the correct row. This may take a
            long time for a large table that has many indexes. Normally,
      <a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
       <span class="command">
        <strong>
         myisamchk
        </strong>
       </span>
      </a>
      stops after the first error it
            finds. If you want to obtain more information, you can add
            the
      <code class="option">
       -v
      </code>
      (verbose) option. This causes
      <a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
       <span class="command">
        <strong>
         myisamchk
        </strong>
       </span>
      </a>
      to keep going, up through a
            maximum of 20 errors.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
       <span class="command">
        <strong>
         myisamchk -e -i
         <em class="replaceable">
          <code>
           tbl_name
          </code>
         </em>
        </strong>
       </span>
      </a>
     </p>
     <p>
      This is like the previous command, but the
      <code class="option">
       -i
      </code>
      option tells
      <a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
       <span class="command">
        <strong>
         myisamchk
        </strong>
       </span>
      </a>
      to print additional statistical
            information.
     </p>
    </li>
   </ul>
  </div>
  <p>
   In most cases, a simple
   <a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
    <span class="command">
     <strong>
      myisamchk
     </strong>
    </span>
   </a>
   command
        with no arguments other than the table name is sufficient to
        check a table.
  </p>
 </div>
 <br/>
</div>
