Answers.Body: <p>The quickfix for this issue is to login to phpMyAdmin and execute the following command in the SQL tab:</p>
  
  <pre><code>REPAIR TABLE craft_searchindex;
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-27T13:14:10.243Z
Answers.LastActivityDate: 2018-09-27T13:14:10.243Z
Answers.UserDisplayName: Oleg
Answers.Body: <p>TL/DR: MySQL is horrible.</p>
  
  <p>The <code>craft_searchindex</code> table is the only table that uses MySQL's older MyISAM storage engine, instead of InnoDB (like the rest of the tables), because InnoDB didn't add support for MySQL's full text search capabilities until very recently (version 5.6.4).</p>
  
  <p>One of the many drawbacks of the MyISAM storage engine, as you've discovered, is that the tables using it can crash easily.  The crashes can occur for a variety of reasons... low disk space, firmware issues, buggy MySQL, sudden server reboot, etc.</p>
  
  <p>From the command line, you can run a "repair all" like so:</p>
  
  <pre><code>mysqlrepair -A --auto-repair
  mysqlrepair -A -o
  </code></pre>
  
  <p>Or start a test that might help you diagnose why it's crashing:</p>
  
  <pre><code>mysqlrepair -A -c
  </code></pre>
  
  <p>Also, if you know you're running > MySQL 5.6.4 across all of your environments, you can change the storage engine for that table from MyISAM to InnoDB.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-03T15:49:51.763Z
Answers.Text: It keeps crashing for me when I start load testing with *very* gentle settings. Any idea how to circumvent this?
Answers.UserDisplayName: Tibor Szasz
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-09T17:08:21.147Z
Answers.Text: Changing the `craft_searchindex` table to InnoDB will cause bugs now:
  https://github.com/craftcms/cms/issues/3862
Answers.UserDisplayName: missmatsuko
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-12-17T16:30:07.313Z
Answers.LastActivityDate: 2016-09-19T22:39:32.533Z
Answers.LastEditDate: 2016-09-19T22:39:32.533Z
Answers.UserDisplayName: Brad Bell
Body: <p>On my local machine, every time I've added a new field and want to add content to it for the first time I get the following error:</p>
  
  <blockquote>
    <p>CDbException</p>
    
    <p>CDbCommand failed to execute the SQL statement:
    SQLSTATE[HY000]: General error: 145 Table
    './databasename/craft_searchindex' is marked as crashed and should
    be repaired.</p>
  </blockquote>
  
  <p>A simple mysql repair table fixes it, but this happens way too often. Is there something I can do to prevent this?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-05-03T15:50:55.020Z
Comments.Text: Did you resolve the issue? I'm in the same shoes.
Comments.UserDisplayName: Tibor Szasz
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-05-03T02:11:46.580Z
Comments.Text: Just had this happen on the latest version (at the time) 3.0.5 :/
Comments.UserDisplayName: mylesthe.dev
Tags: <database>
Title: craft_searchindex table keeps crashing
ThreadText: # craft_searchindex table keeps crashing
  
  (Asked by: username_0 on 2014-12-17)
  
  On my local machine, every time I've added a new field and want to add content to it for the first time I get the following error:
  
  > CDbException
  >
  > CDbCommand failed to execute the SQL statement:
  > SQLSTATE[HY000]: General error: 145 Table
  > './databasename/craft\_searchindex' is marked as crashed and should
  > be repaired.
  
  A simple mysql repair table fixes it, but this happens way too often. Is there something I can do to prevent this?
  
  **Tags:** database
  
  > **Comments:**
  > **username_1**: Did you resolve the issue? I'm in the same shoes.  
  > **username_2**: Just had this happen on the latest version (at the time) 3.0.5 :/  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_4 on 2014-12-17. Score: 9 | Accepted answer
  
  TL/DR: MySQL is horrible.
  
  The `craft_searchindex` table is the only table that uses MySQL's older MyISAM storage engine, instead of InnoDB (like the rest of the tables), because InnoDB didn't add support for MySQL's full text search capabilities until very recently (version 5.6.4).
  
  One of the many drawbacks of the MyISAM storage engine, as you've discovered, is that the tables using it can crash easily. The crashes can occur for a variety of reasons... low disk space, firmware issues, buggy MySQL, sudden server reboot, etc.
  
  From the command line, you can run a "repair all" like so:
  
  ```
  mysqlrepair -A --auto-repair
  mysqlrepair -A -o
  
  ```
  
  Or start a test that might help you diagnose why it's crashing:
  
  ```
  mysqlrepair -A -c
  
  ```
  
  Also, if you know you're running > MySQL 5.6.4 across all of your environments, you can change the storage engine for that table from MyISAM to InnoDB.
  
  > **Comments:**
  > **username_1**: It keeps crashing for me when I start load testing with *very* gentle settings. Any idea how to circumvent this?  
  > **username_5**: Changing the `craft_searchindex` table to InnoDB will cause bugs now: https://github.com/craftcms/cms/issues/3862  
  
  ---
  
  ### Answer by username_3 on 2018-09-27. Score: 2
  
  The quickfix for this issue is to login to phpMyAdmin and execute the following command in the SQL tab:
  
  ```
  REPAIR TABLE craft_searchindex;
  
  ```
  
  
  ---
  
  