<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="myisamchk-repair-options">
      </a>
      6.6.4.3 myisamchk Repair Options
     </h4>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045307114032">
  </a>
  <a class="indexterm" name="idm46045307112544">
  </a>
  <p>
   <a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
    <span class="command">
     <strong>
      myisamchk
     </strong>
    </span>
   </a>
   supports the following options for
        table repair operations (operations performed when an option
        such as
   <a class="link" href="myisamchk-repair-options.html#option_myisamchk_recover">
    <code class="option">
     --recover
    </code>
   </a>
   or
   <a class="link" href="myisamchk-repair-options.html#option_myisamchk_safe-recover">
    <code class="option">
     --safe-recover
    </code>
   </a>
   is given):
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <a name="option_myisamchk_backup">
      </a>
      <a class="link" href="myisamchk-repair-options.html#option_myisamchk_backup">
       <code class="option">
        --backup
       </code>
      </a>
      ,
      <code class="option">
       -B
      </code>
     </p>
     <div class="informaltable">
      <table frame="box" rules="all" summary="Properties for backup">
       <colgroup>
        <col style="width: 30%"/>
        <col style="width: 70%"/>
       </colgroup>
       <tbody>
        <tr>
         <th>
          Command-Line Format
         </th>
         <td>
          <code class="literal">
           --backup
          </code>
         </td>
        </tr>
       </tbody>
      </table>
     </div>
     <a class="indexterm" name="idm46045307099168">
     </a>
     <a class="indexterm" name="idm46045307097680">
     </a>
     <p>
      Make a backup of the
      <code class="filename">
       .MYD
      </code>
      file as
      <code class="filename">
       <em class="replaceable">
        <code>
         file_name
        </code>
       </em>
       -
       <em class="replaceable">
        <code>
         time
        </code>
       </em>
       .BAK
      </code>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="option_myisamchk_character-sets-dir">
      </a>
      <a class="link" href="myisamchk-repair-options.html#option_myisamchk_character-sets-dir">
       <code class="option">
        --character-sets-dir=
        <em class="replaceable">
         <code>
          dir_name
         </code>
        </em>
       </code>
      </a>
     </p>
     <div class="informaltable">
      <table frame="box" rules="all" summary="Properties for character-sets-dir">
       <colgroup>
        <col style="width: 30%"/>
        <col style="width: 70%"/>
       </colgroup>
       <tbody>
        <tr>
         <th>
          Command-Line Format
         </th>
         <td>
          <code class="literal">
           --character-sets-dir=path
          </code>
         </td>
        </tr>
        <tr>
         <th>
          Type
         </th>
         <td>
          String
         </td>
        </tr>
        <tr>
         <th>
          Default Value
         </th>
         <td>
          <code class="literal">
           [none]
          </code>
         </td>
        </tr>
       </tbody>
      </table>
     </div>
     <a class="indexterm" name="idm46045307081136">
     </a>
     <a class="indexterm" name="idm46045307079632">
     </a>
     <p>
      The directory where character sets are installed. See
      <a class="xref" href="charset-configuration.html" title="12.15 Character Set Configuration">
       Section 12.15, “Character Set Configuration”
      </a>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="option_myisamchk_correct-checksum">
      </a>
      <a class="link" href="myisamchk-repair-options.html#option_myisamchk_correct-checksum">
       <code class="option">
        --correct-checksum
       </code>
      </a>
     </p>
     <div class="informaltable">
      <table frame="box" rules="all" summary="Properties for correct-checksum">
       <colgroup>
        <col style="width: 30%"/>
        <col style="width: 70%"/>
       </colgroup>
       <tbody>
        <tr>
         <th>
          Command-Line Format
         </th>
         <td>
          <code class="literal">
           --correct-checksum
          </code>
         </td>
        </tr>
       </tbody>
      </table>
     </div>
     <a class="indexterm" name="idm46045307069328">
     </a>
     <a class="indexterm" name="idm46045307067840">
     </a>
     <p>
      Correct the checksum information for the table.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="option_myisamchk_data-file-length">
      </a>
      <a class="link" href="myisamchk-repair-options.html#option_myisamchk_data-file-length">
       <code class="option">
        --data-file-length=
        <em class="replaceable">
         <code>
          len
         </code>
        </em>
       </code>
      </a>
      ,
      <code class="option">
       -D
       <em class="replaceable">
        <code>
         len
        </code>
       </em>
      </code>
     </p>
     <div class="informaltable">
      <table frame="box" rules="all" summary="Properties for data-file-length">
       <colgroup>
        <col style="width: 30%"/>
        <col style="width: 70%"/>
       </colgroup>
       <tbody>
        <tr>
         <th>
          Command-Line Format
         </th>
         <td>
          <code class="literal">
           --data-file-length=len
          </code>
         </td>
        </tr>
        <tr>
         <th>
          Type
         </th>
         <td>
          Numeric
         </td>
        </tr>
       </tbody>
      </table>
     </div>
     <a class="indexterm" name="idm46045307055216">
     </a>
     <a class="indexterm" name="idm46045307053728">
     </a>
     <p>
      The maximum length of the data file (when re-creating data
            file when it is
      <span class="quote">
       “
       <span class="quote">
        full
       </span>
       ”
      </span>
      ).
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="myisamchk-check-options.html#option_myisamchk_extend-check">
       <code class="option">
        --extend-check
       </code>
      </a>
      ,
      <code class="option">
       -e
      </code>
      <a class="indexterm" name="idm46045307049232">
      </a>
      <a class="indexterm" name="idm46045307047744">
      </a>
     </p>
     <div class="informaltable">
      <table frame="box" rules="all" summary="Properties for extend-check">
       <colgroup>
        <col style="width: 30%"/>
        <col style="width: 70%"/>
       </colgroup>
       <tbody>
        <tr>
         <th>
          Command-Line Format
         </th>
         <td>
          <code class="literal">
           --extend-check
          </code>
         </td>
        </tr>
       </tbody>
      </table>
     </div>
     <a class="indexterm" name="idm46045307040656">
     </a>
     <a class="indexterm" name="idm46045307039168">
     </a>
     <p>
      Do a repair that tries to recover every possible row from
            the data file. Normally, this also finds a lot of garbage
            rows. Do not use this option unless you are desperate.
     </p>
     <p>
      See also the description of this option under table checking
            options.
     </p>
     <p>
      For a description of the output format, see
      <a class="xref" href="myisamchk-table-info.html" title="6.6.4.5 Obtaining Table Information with myisamchk">
       Section 6.6.4.5, “Obtaining Table Information with myisamchk”
      </a>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="myisamchk-check-options.html#option_myisamchk_force">
       <code class="option">
        --force
       </code>
      </a>
      ,
      <code class="option">
       -f
      </code>
     </p>
     <div class="informaltable">
      <table frame="box" rules="all" summary="Properties for force">
       <colgroup>
        <col style="width: 30%"/>
        <col style="width: 70%"/>
       </colgroup>
       <tbody>
        <tr>
         <th>
          Command-Line Format
         </th>
         <td>
          <code class="literal">
           --force
          </code>
         </td>
        </tr>
       </tbody>
      </table>
     </div>
     <a class="indexterm" name="idm46045307027792">
     </a>
     <a class="indexterm" name="idm46045307026304">
     </a>
     <p>
      Overwrite old intermediate files (files with names like
      <code class="filename">
       <em class="replaceable">
        <code>
         tbl_name
        </code>
       </em>
       .TMD
      </code>
      )
            instead of aborting.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="option_myisamchk_keys-used">
      </a>
      <a class="link" href="myisamchk-repair-options.html#option_myisamchk_keys-used">
       <code class="option">
        --keys-used=
        <em class="replaceable">
         <code>
          val
         </code>
        </em>
       </code>
      </a>
      ,
      <code class="option">
       -k
       <em class="replaceable">
        <code>
         val
        </code>
       </em>
      </code>
     </p>
     <div class="informaltable">
      <table frame="box" rules="all" summary="Properties for keys-used">
       <colgroup>
        <col style="width: 30%"/>
        <col style="width: 70%"/>
       </colgroup>
       <tbody>
        <tr>
         <th>
          Command-Line Format
         </th>
         <td>
          <code class="literal">
           --keys-used=val
          </code>
         </td>
        </tr>
        <tr>
         <th>
          Type
         </th>
         <td>
          Numeric
         </td>
        </tr>
       </tbody>
      </table>
     </div>
     <a class="indexterm" name="idm46045307012672">
     </a>
     <a class="indexterm" name="idm46045307011184">
     </a>
     <p>
      For
      <a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
       <span class="command">
        <strong>
         myisamchk
        </strong>
       </span>
      </a>
      , the option value is a bit
            value that indicates which indexes to update. Each binary
            bit of the option value corresponds to a table index, where
            the first index is bit 0. An option value of 0 disables
            updates to all indexes, which can be used to get faster
            inserts. Deactivated indexes can be reactivated by using
      <a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
       <span class="command">
        <strong>
         myisamchk -r
        </strong>
       </span>
      </a>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="option_myisamchk_max-record-length">
      </a>
      <a class="link" href="myisamchk-repair-options.html#option_myisamchk_max-record-length">
       <code class="option">
        --max-record-length=
        <em class="replaceable">
         <code>
          len
         </code>
        </em>
       </code>
      </a>
     </p>
     <div class="informaltable">
      <table frame="box" rules="all" summary="Properties for max-record-length">
       <colgroup>
        <col style="width: 30%"/>
        <col style="width: 70%"/>
       </colgroup>
       <tbody>
        <tr>
         <th>
          Command-Line Format
         </th>
         <td>
          <code class="literal">
           --max-record-length=len
          </code>
         </td>
        </tr>
        <tr>
         <th>
          Type
         </th>
         <td>
          Numeric
         </td>
        </tr>
       </tbody>
      </table>
     </div>
     <a class="indexterm" name="idm46045306996496">
     </a>
     <a class="indexterm" name="idm46045306994992">
     </a>
     <p>
      Skip rows larger than the given length if
      <a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
       <span class="command">
        <strong>
         myisamchk
        </strong>
       </span>
      </a>
      cannot allocate memory to hold
            them.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="option_myisamchk_quick">
      </a>
      <a class="link" href="myisamchk-repair-options.html#option_myisamchk_quick">
       <code class="option">
        --quick
       </code>
      </a>
      ,
      <code class="option">
       -q
      </code>
     </p>
     <div class="informaltable">
      <table frame="box" rules="all" summary="Properties for quick">
       <colgroup>
        <col style="width: 30%"/>
        <col style="width: 70%"/>
       </colgroup>
       <tbody>
        <tr>
         <th>
          Command-Line Format
         </th>
         <td>
          <code class="literal">
           --quick
          </code>
         </td>
        </tr>
       </tbody>
      </table>
     </div>
     <a class="indexterm" name="idm46045306983696">
     </a>
     <a class="indexterm" name="idm46045306982208">
     </a>
     <p>
      Achieve a faster repair by modifying only the index file,
            not the data file. You can specify this option twice to
            force
      <a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
       <span class="command">
        <strong>
         myisamchk
        </strong>
       </span>
      </a>
      to modify the original
            data file in case of duplicate keys.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="option_myisamchk_recover">
      </a>
      <a class="link" href="myisamchk-repair-options.html#option_myisamchk_recover">
       <code class="option">
        --recover
       </code>
      </a>
      ,
      <code class="option">
       -r
      </code>
     </p>
     <div class="informaltable">
      <table frame="box" rules="all" summary="Properties for recover">
       <colgroup>
        <col style="width: 30%"/>
        <col style="width: 70%"/>
       </colgroup>
       <tbody>
        <tr>
         <th>
          Command-Line Format
         </th>
         <td>
          <code class="literal">
           --recover
          </code>
         </td>
        </tr>
       </tbody>
      </table>
     </div>
     <a class="indexterm" name="idm46045306970704">
     </a>
     <a class="indexterm" name="idm46045306969216">
     </a>
     <p>
      Do a repair that can fix almost any problem except unique
            keys that are not unique (which is an extremely unlikely
            error with
      <code class="literal">
       MyISAM
      </code>
      tables). If you want to
            recover a table, this is the option to try first. You should
            try
      <a class="link" href="myisamchk-repair-options.html#option_myisamchk_safe-recover">
       <code class="option">
        --safe-recover
       </code>
      </a>
      only if
      <a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
       <span class="command">
        <strong>
         myisamchk
        </strong>
       </span>
      </a>
      reports that the table cannot
            be recovered using
      <a class="link" href="myisamchk-repair-options.html#option_myisamchk_recover">
       <code class="option">
        --recover
       </code>
      </a>
      . (In the
            unlikely case that
      <a class="link" href="myisamchk-repair-options.html#option_myisamchk_recover">
       <code class="option">
        --recover
       </code>
      </a>
      fails, the data
            file remains intact.)
     </p>
     <p>
      If you have lots of memory, you should increase the value of
      <code class="literal">
       myisam_sort_buffer_size
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="option_myisamchk_safe-recover">
      </a>
      <a class="link" href="myisamchk-repair-options.html#option_myisamchk_safe-recover">
       <code class="option">
        --safe-recover
       </code>
      </a>
      ,
      <code class="option">
       -o
      </code>
     </p>
     <div class="informaltable">
      <table frame="box" rules="all" summary="Properties for safe-recover">
       <colgroup>
        <col style="width: 30%"/>
        <col style="width: 70%"/>
       </colgroup>
       <tbody>
        <tr>
         <th>
          Command-Line Format
         </th>
         <td>
          <code class="literal">
           --safe-recover
          </code>
         </td>
        </tr>
       </tbody>
      </table>
     </div>
     <a class="indexterm" name="idm46045306952784">
     </a>
     <a class="indexterm" name="idm46045306951296">
     </a>
     <p>
      Do a repair using an old recovery method that reads through
            all rows in order and updates all index trees based on the
            rows found. This is an order of magnitude slower than
      <a class="link" href="myisamchk-repair-options.html#option_myisamchk_recover">
       <code class="option">
        --recover
       </code>
      </a>
      , but can handle
            a couple of very unlikely cases that
      <a class="link" href="myisamchk-repair-options.html#option_myisamchk_recover">
       <code class="option">
        --recover
       </code>
      </a>
      cannot. This
            recovery method also uses much less disk space than
      <a class="link" href="myisamchk-repair-options.html#option_myisamchk_recover">
       <code class="option">
        --recover
       </code>
      </a>
      . Normally, you
            should repair first using
      <a class="link" href="myisamchk-repair-options.html#option_myisamchk_recover">
       <code class="option">
        --recover
       </code>
      </a>
      , and then with
      <a class="link" href="myisamchk-repair-options.html#option_myisamchk_safe-recover">
       <code class="option">
        --safe-recover
       </code>
      </a>
      only if
      <a class="link" href="myisamchk-repair-options.html#option_myisamchk_recover">
       <code class="option">
        --recover
       </code>
      </a>
      fails.
     </p>
     <p>
      If you have lots of memory, you should increase the value of
      <code class="literal">
       key_buffer_size
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="option_myisamchk_set-collation">
      </a>
      <a class="link" href="myisamchk-repair-options.html#option_myisamchk_set-collation">
       <code class="option">
        --set-collation=
        <em class="replaceable">
         <code>
          name
         </code>
        </em>
       </code>
      </a>
     </p>
     <div class="informaltable">
      <table frame="box" rules="all" summary="Properties for set-collation">
       <colgroup>
        <col style="width: 30%"/>
        <col style="width: 70%"/>
       </colgroup>
       <tbody>
        <tr>
         <th>
          Command-Line Format
         </th>
         <td>
          <code class="literal">
           --set-collation=name
          </code>
         </td>
        </tr>
        <tr>
         <th>
          Type
         </th>
         <td>
          String
         </td>
        </tr>
       </tbody>
      </table>
     </div>
     <a class="indexterm" name="idm46045306931840">
     </a>
     <a class="indexterm" name="idm46045306930352">
     </a>
     <p>
      Specify the collation to use for sorting table indexes. The
            character set name is implied by the first part of the
            collation name.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="option_myisamchk_sort-recover">
      </a>
      <a class="link" href="myisamchk-repair-options.html#option_myisamchk_sort-recover">
       <code class="option">
        --sort-recover
       </code>
      </a>
      ,
      <code class="option">
       -n
      </code>
     </p>
     <div class="informaltable">
      <table frame="box" rules="all" summary="Properties for sort-recover">
       <colgroup>
        <col style="width: 30%"/>
        <col style="width: 70%"/>
       </colgroup>
       <tbody>
        <tr>
         <th>
          Command-Line Format
         </th>
         <td>
          <code class="literal">
           --sort-recover
          </code>
         </td>
        </tr>
       </tbody>
      </table>
     </div>
     <a class="indexterm" name="idm46045306920224">
     </a>
     <a class="indexterm" name="idm46045306918736">
     </a>
     <p>
      Force
      <a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
       <span class="command">
        <strong>
         myisamchk
        </strong>
       </span>
      </a>
      to use sorting to resolve
            the keys even if the temporary files would be very large.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="option_myisamchk_tmpdir">
      </a>
      <a class="link" href="myisamchk-repair-options.html#option_myisamchk_tmpdir">
       <code class="option">
        --tmpdir=
        <em class="replaceable">
         <code>
          dir_name
         </code>
        </em>
       </code>
      </a>
      ,
      <code class="option">
       -t
       <em class="replaceable">
        <code>
         dir_name
        </code>
       </em>
      </code>
     </p>
     <div class="informaltable">
      <table frame="box" rules="all" summary="Properties for tmpdir">
       <colgroup>
        <col style="width: 30%"/>
        <col style="width: 70%"/>
       </colgroup>
       <tbody>
        <tr>
         <th>
          Command-Line Format
         </th>
         <td>
          <code class="literal">
           --tmpdir=dir_name
          </code>
         </td>
        </tr>
        <tr>
         <th>
          Type
         </th>
         <td>
          Directory name
         </td>
        </tr>
       </tbody>
      </table>
     </div>
     <a class="indexterm" name="idm46045306904896">
     </a>
     <a class="indexterm" name="idm46045306903408">
     </a>
     <p>
      The path of the directory to be used for storing temporary
            files. If this is not set,
      <a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
       <span class="command">
        <strong>
         myisamchk
        </strong>
       </span>
      </a>
      uses
            the value of the
      <code class="literal">
       TMPDIR
      </code>
      environment
            variable.
      <a class="link" href="myisamchk-repair-options.html#option_myisamchk_tmpdir">
       <code class="option">
        --tmpdir
       </code>
      </a>
      can be
            set to a list of directory paths that are used successively
            in round-robin fashion for creating temporary files. The
            separator character between directory names is the colon
            (
      <code class="literal">
       :
      </code>
      ) on Unix and the semicolon
            (
      <code class="literal">
       ;
      </code>
      ) on Windows.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="option_myisamchk_unpack">
      </a>
      <a class="link" href="myisamchk-repair-options.html#option_myisamchk_unpack">
       <code class="option">
        --unpack
       </code>
      </a>
      ,
      <code class="option">
       -u
      </code>
     </p>
     <div class="informaltable">
      <table frame="box" rules="all" summary="Properties for unpack">
       <colgroup>
        <col style="width: 30%"/>
        <col style="width: 70%"/>
       </colgroup>
       <tbody>
        <tr>
         <th>
          Command-Line Format
         </th>
         <td>
          <code class="literal">
           --unpack
          </code>
         </td>
        </tr>
       </tbody>
      </table>
     </div>
     <a class="indexterm" name="idm46045306888784">
     </a>
     <a class="indexterm" name="idm46045306887296">
     </a>
     <p>
      Unpack a table that was packed with
      <a class="link" href="myisampack.html" title="6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables">
       <span class="command">
        <strong>
         myisampack
        </strong>
       </span>
      </a>
      .
     </p>
    </li>
   </ul>
  </div>
 </div>
 <br/>
</div>
