MySQL: #126 - Incorrect key file for table

前端 未结 17 1805
臣服心动
臣服心动 2020-11-29 02:18

I got the following error from a MySQL query.

#126 - Incorrect key file for table

I have not even declared a key for this table, but I do have i

相关标签:
17条回答
  • 2020-11-29 02:44
    mysql> set global sql_slave_skip_counter=1; start slave; show slave status\G
    

    Then got error exists :

     Error 'Table './openx/f_scraper_banner_details' is marked as crashed and should be repaired' on query. Default database: 'openx'. Query: 'INSERT INTO f_scraper_banner_details(job_details_id, ad_id, client_id, zone_id, affiliateid, comments, pct_to_report, publisher_currency, sanity_check_enabled, status, error_code, report_date) VALUES (10274859, 321264, 0, 31926, 0, '', -1, 'USD', 1, 'FAILURE', 'INACTIVE_BANNER', '2016-06-28 04:00:00')'
    
     mysql> repair table f_scraper_banner_details;
    

    This worked for me

    0 讨论(0)
  • 2020-11-29 02:49

    I fixed this issue with:

    ALTER TABLE table ENGINE MyISAM;
    ALTER IGNORE TABLE table ADD UNIQUE INDEX dupidx (field);
    ALTER TABLE table ENGINE InnoDB;
    

    May helps

    • Refs: MySQL: ALTER IGNORE TABLE gives "Integrity constraint violation"
    0 讨论(0)
  • 2020-11-29 02:51

    Every Time this has happened, it's been a full disk in my experience.

    EDIT

    It is also worth noting that this can be caused by a full ramdisk when doing things like altering a large table if you have a ramdisk configured. You can temporarily comment out the ramdisk line to allow such operations if you can't increase the size of it.

    0 讨论(0)
  • 2020-11-29 02:55

    My issue came from a bad query. I referenced a table in FROM the was not referenced in SELECT.

    example:

       SELECT t.*,s.ticket_status as `ticket_status`
       FROM tickets_new t, ticket_status s, users u
    

    , users u is what was causing the issue for me. Removing that solved the issue.

    For reference this was in a CodeIgniter dev environment.

    0 讨论(0)
  • 2020-11-29 02:57
    repair table myschema.mytable;
    
    0 讨论(0)
提交回复
热议问题