<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h3 class="title">
      <a name="myisam-start">
      </a>
      18.2.1 MyISAM Startup Options
     </h3>
    </div>
   </div>
  </div>
  <p>
   The following options to
   <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
    <span class="command">
     <strong>
      mysqld
     </strong>
    </span>
   </a>
   can be used to
      change the behavior of
   <code class="literal">
    MyISAM
   </code>
   tables. For
      additional information, see
   <a class="xref" href="server-options.html" title="7.1.7 Server Command Options">
    Section 7.1.7, “Server Command Options”
   </a>
   .
  </p>
  <div class="table">
   <a name="idm46045148327984">
   </a>
   <p class="title">
    <b>
     Table 18.3 MyISAM Option and Variable Reference
    </b>
   </p>
   <div class="table-contents">
    <table frame="box" rules="all" summary="Reference for MyISAM command-line options and system variables.">
     <colgroup>
      <col style="width: 20%"/>
      <col style="width: 15%"/>
      <col style="width: 15%"/>
      <col style="width: 15%"/>
      <col style="width: 15%"/>
      <col style="width: 15%"/>
      <col style="width: 15%"/>
     </colgroup>
     <thead>
      <tr>
       <th scope="col">
        Name
       </th>
       <th scope="col">
        Cmd-Line
       </th>
       <th scope="col">
        Option File
       </th>
       <th scope="col">
        System Var
       </th>
       <th scope="col">
        Status Var
       </th>
       <th scope="col">
        Var Scope
       </th>
       <th scope="col">
        Dynamic
       </th>
      </tr>
     </thead>
     <tbody>
      <tr>
       <th scope="row">
        <a class="link" href="server-system-variables.html#sysvar_bulk_insert_buffer_size">
         bulk_insert_buffer_size
        </a>
       </th>
       <td>
        Yes
       </td>
       <td>
        Yes
       </td>
       <td>
        Yes
       </td>
       <td>
       </td>
       <td>
        Both
       </td>
       <td>
        Yes
       </td>
      </tr>
      <tr>
       <th scope="row">
        <a class="link" href="server-system-variables.html#sysvar_concurrent_insert">
         concurrent_insert
        </a>
       </th>
       <td>
        Yes
       </td>
       <td>
        Yes
       </td>
       <td>
        Yes
       </td>
       <td>
       </td>
       <td>
        Global
       </td>
       <td>
        Yes
       </td>
      </tr>
      <tr>
       <th scope="row">
        <a class="link" href="server-system-variables.html#sysvar_delay_key_write">
         delay_key_write
        </a>
       </th>
       <td>
        Yes
       </td>
       <td>
        Yes
       </td>
       <td>
        Yes
       </td>
       <td>
       </td>
       <td>
        Global
       </td>
       <td>
        Yes
       </td>
      </tr>
      <tr>
       <th scope="row">
        <a class="link" href="server-system-variables.html#sysvar_have_rtree_keys">
         have_rtree_keys
        </a>
       </th>
       <td>
       </td>
       <td>
       </td>
       <td>
        Yes
       </td>
       <td>
       </td>
       <td>
        Global
       </td>
       <td>
        No
       </td>
      </tr>
      <tr>
       <th scope="row">
        <a class="link" href="server-system-variables.html#sysvar_key_buffer_size">
         key_buffer_size
        </a>
       </th>
       <td>
        Yes
       </td>
       <td>
        Yes
       </td>
       <td>
        Yes
       </td>
       <td>
       </td>
       <td>
        Global
       </td>
       <td>
        Yes
       </td>
      </tr>
      <tr>
       <th scope="row">
        <a class="link" href="server-options.html#option_mysqld_log-isam">
         log-isam
        </a>
       </th>
       <td>
        Yes
       </td>
       <td>
        Yes
       </td>
       <td>
       </td>
       <td>
       </td>
       <td>
       </td>
       <td>
       </td>
      </tr>
      <tr>
       <th scope="row">
        <a class="link" href="server-options.html#option_mysqld_myisam-block-size">
         myisam-block-size
        </a>
       </th>
       <td>
        Yes
       </td>
       <td>
        Yes
       </td>
       <td>
       </td>
       <td>
       </td>
       <td>
       </td>
       <td>
       </td>
      </tr>
      <tr>
       <th scope="row">
        <a class="link" href="server-system-variables.html#sysvar_myisam_data_pointer_size">
         myisam_data_pointer_size
        </a>
       </th>
       <td>
        Yes
       </td>
       <td>
        Yes
       </td>
       <td>
        Yes
       </td>
       <td>
       </td>
       <td>
        Global
       </td>
       <td>
        Yes
       </td>
      </tr>
      <tr>
       <th scope="row">
        <a class="link" href="server-system-variables.html#sysvar_myisam_max_sort_file_size">
         myisam_max_sort_file_size
        </a>
       </th>
       <td>
        Yes
       </td>
       <td>
        Yes
       </td>
       <td>
        Yes
       </td>
       <td>
       </td>
       <td>
        Global
       </td>
       <td>
        Yes
       </td>
      </tr>
      <tr>
       <th scope="row">
        <a class="link" href="server-system-variables.html#sysvar_myisam_mmap_size">
         myisam_mmap_size
        </a>
       </th>
       <td>
        Yes
       </td>
       <td>
        Yes
       </td>
       <td>
        Yes
       </td>
       <td>
       </td>
       <td>
        Global
       </td>
       <td>
        No
       </td>
      </tr>
      <tr>
       <th scope="row">
        <a class="link" href="server-system-variables.html#sysvar_myisam_recover_options">
         myisam_recover_options
        </a>
       </th>
       <td>
        Yes
       </td>
       <td>
        Yes
       </td>
       <td>
        Yes
       </td>
       <td>
       </td>
       <td>
        Global
       </td>
       <td>
        No
       </td>
      </tr>
      <tr>
       <th scope="row">
        <a class="link" href="server-system-variables.html#sysvar_myisam_sort_buffer_size">
         myisam_sort_buffer_size
        </a>
       </th>
       <td>
        Yes
       </td>
       <td>
        Yes
       </td>
       <td>
        Yes
       </td>
       <td>
       </td>
       <td>
        Both
       </td>
       <td>
        Yes
       </td>
      </tr>
      <tr>
       <th scope="row">
        <a class="link" href="server-system-variables.html#sysvar_myisam_stats_method">
         myisam_stats_method
        </a>
       </th>
       <td>
        Yes
       </td>
       <td>
        Yes
       </td>
       <td>
        Yes
       </td>
       <td>
       </td>
       <td>
        Both
       </td>
       <td>
        Yes
       </td>
      </tr>
      <tr>
       <th scope="row">
        <a class="link" href="server-system-variables.html#sysvar_myisam_use_mmap">
         myisam_use_mmap
        </a>
       </th>
       <td>
        Yes
       </td>
       <td>
        Yes
       </td>
       <td>
        Yes
       </td>
       <td>
       </td>
       <td>
        Global
       </td>
       <td>
        Yes
       </td>
      </tr>
      <tr>
       <th scope="row">
        <a class="link" href="server-system-variables.html#sysvar_tmp_table_size">
         tmp_table_size
        </a>
       </th>
       <td>
        Yes
       </td>
       <td>
        Yes
       </td>
       <td>
        Yes
       </td>
       <td>
       </td>
       <td>
        Both
       </td>
       <td>
        Yes
       </td>
      </tr>
     </tbody>
    </table>
   </div>
   <div class="table-contents">
    <table cellpadding="0" cellspacing="0" style="position: fixed; top: 0px; display: none; left: 401px; width: 739px;">
     <thead>
      <tr>
       <th scope="col" style="width: 195.406px;">
        Name
       </th>
       <th scope="col" style="width: 92.4375px;">
        Cmd-Line
       </th>
       <th scope="col" style="width: 95.8125px;">
        Option File
       </th>
       <th scope="col" style="width: 96.5px;">
        System Var
       </th>
       <th scope="col" style="width: 94.7812px;">
        Status Var
       </th>
       <th scope="col" style="width: 93.7344px;">
        Var Scope
       </th>
       <th scope="col" style="width: 69.3281px;">
        Dynamic
       </th>
      </tr>
     </thead>
    </table>
   </div>
  </div>
  <br class="table-break"/>
  <p>
   The following system variables affect the behavior of
   <code class="literal">
    MyISAM
   </code>
   tables. For additional information, see
   <a class="xref" href="server-system-variables.html" title="7.1.8 Server System Variables">
    Section 7.1.8, “Server System Variables”
   </a>
   .
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <a class="link" href="server-system-variables.html#sysvar_bulk_insert_buffer_size">
       <code class="literal">
        bulk_insert_buffer_size
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045148203872">
     </a>
     <a class="indexterm" name="idm46045148202832">
     </a>
     <p>
      The size of the tree cache used in bulk insert optimization.
     </p>
     <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
      <div class="admon-title">
       Note
      </div>
      <p>
       This is a limit
       <span class="emphasis">
        <em>
         per thread
        </em>
       </span>
       !
      </p>
     </div>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="server-system-variables.html#sysvar_delay_key_write">
       <code class="option">
        delay_key_write=ALL
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045148197904">
     </a>
     <a class="indexterm" name="idm46045148196816">
     </a>
     <p>
      Don't flush key buffers between writes for any
      <code class="literal">
       MyISAM
      </code>
      table.
     </p>
     <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
      <div class="admon-title">
       Note
      </div>
      <p>
       If you do this, you should not access
       <code class="literal">
        MyISAM
       </code>
       tables from another program (such
            as from another MySQL server or with
       <a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
        <span class="command">
         <strong>
          myisamchk
         </strong>
        </span>
       </a>
       ) when the tables are in use.
            Doing so risks index corruption. Using
       <a class="link" href="server-options.html#option_mysqld_external-locking">
        <code class="option">
         --external-locking
        </code>
       </a>
       does not
            eliminate this risk.
      </p>
     </div>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="server-system-variables.html#sysvar_myisam_max_sort_file_size">
       <code class="literal">
        myisam_max_sort_file_size
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045148188144">
     </a>
     <a class="indexterm" name="idm46045148187040">
     </a>
     <p>
      The maximum size of the temporary file that MySQL is permitted
          to use while re-creating a
      <code class="literal">
       MyISAM
      </code>
      index
          (during
      <a class="link" href="repair-table.html" title="15.7.3.5 REPAIR TABLE Statement">
       <code class="literal">
        REPAIR TABLE
       </code>
      </a>
      ,
      <a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
       <code class="literal">
        ALTER TABLE
       </code>
      </a>
      , or
      <a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
       <code class="literal">
        LOAD DATA
       </code>
      </a>
      ). If the file size
          would be larger than this value, the index is created using
          the key cache instead, which is slower. The value is given in
          bytes.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="server-system-variables.html#sysvar_myisam_recover_options">
       <code class="literal">
        myisam_recover_options=
        <em class="replaceable">
         <code>
          mode
         </code>
        </em>
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045148178080">
     </a>
     <a class="indexterm" name="idm46045148177040">
     </a>
     <p>
      Set the mode for automatic recovery of crashed
      <code class="literal">
       MyISAM
      </code>
      tables.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="server-system-variables.html#sysvar_myisam_sort_buffer_size">
       <code class="literal">
        myisam_sort_buffer_size
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045148172320">
     </a>
     <a class="indexterm" name="idm46045148171280">
     </a>
     <p>
      Set the size of the buffer used when recovering tables.
     </p>
    </li>
   </ul>
  </div>
  <p>
   Automatic recovery is activated if you start
   <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
    <span class="command">
     <strong>
      mysqld
     </strong>
    </span>
   </a>
   with the
   <a class="link" href="server-system-variables.html#sysvar_myisam_recover_options">
    <code class="literal">
     myisam_recover_options
    </code>
   </a>
   system
      variable set. In this case, when the server opens a
   <code class="literal">
    MyISAM
   </code>
   table, it checks whether the table is
      marked as crashed or whether the open count variable for the table
      is not 0 and you are running the server with external locking
      disabled. If either of these conditions is true, the following
      happens:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      The server checks the table for errors.
     </p>
    </li>
    <li class="listitem">
     <p>
      If the server finds an error, it tries to do a fast table
          repair (with sorting and without re-creating the data file).
     </p>
    </li>
    <li class="listitem">
     <p>
      If the repair fails because of an error in the data file (for
          example, a duplicate-key error), the server tries again, this
          time re-creating the data file.
     </p>
    </li>
    <li class="listitem">
     <p>
      If the repair still fails, the server tries once more with the
          old repair option method (write row by row without sorting).
          This method should be able to repair any type of error and has
          low disk space requirements.
     </p>
    </li>
   </ul>
  </div>
  <p>
   If the recovery wouldn't be able to recover all rows from
      previously completed statements and you didn't specify
   <code class="literal">
    FORCE
   </code>
   in the value of the
   <a class="link" href="server-system-variables.html#sysvar_myisam_recover_options">
    <code class="literal">
     myisam_recover_options
    </code>
   </a>
   system
      variable, automatic repair aborts with an error message in the
      error log:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-none"><div class="docs-select-all right" id="sa65220076"><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-none">Error: Couldn't repair table: test.g00pages</code></pre>
  </div>
  <p>
   If you specify
   <code class="literal">
    FORCE
   </code>
   , a warning like this is
      written instead:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-none"><div class="docs-select-all right" id="sa57058481"><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-none">Warning: Found 344 of 354 rows when repairing ./test/g00pages</code></pre>
  </div>
  <p>
   If the automatic recovery value includes
   <code class="literal">
    BACKUP
   </code>
   , the recovery process creates files with
      names of the form
   <code class="filename">
    <em class="replaceable">
     <code>
      tbl_name-datetime
     </code>
    </em>
    .BAK
   </code>
   .
      You should have a
   <span class="command">
    <strong>
     cron
    </strong>
   </span>
   script that
      automatically moves these files from the database directories to
      backup media.
  </p>
 </div>
 <br/>
</div>
