MySQL: #126 - Incorrect key file for table

前端 未结 17 1804
臣服心动
臣服心动 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:40

    I know that this is an old topic but none of the solution mentioned worked for me. I have done something else that worked:

    You need to:

    1. stop the MySQL service:
    2. Open mysql\data
    3. Remove both ib_logfile0 and ib_logfile1.
    4. Restart the service
    0 讨论(0)
  • 2020-11-29 02:40

    Try to run a repair command for each one of the tables involved in the query.

    Use MySQL administrator, go to Catalog -> Select your Catalog -> Select a table -> Click the Maintenance button -> Repair -> Use FRM.

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

    Following these instructions allowed me to recreate my tmp directory and fix the issue:

    Display all file systems and their disk usage in human readable form:

    df -h
    

    Find the processes that have files open in /tmp

    sudo lsof /tmp/**/*
    

    Then umount /tmp and /var/tmp:

    umount -l /tmp
    umount -l /var/tmp
    

    Then remove the corrupt partition file:

    rm -fv /usr/tmpDSK
    

    Then create a nice new one:

    /scripts/securetmp
    

    Note that by editing the securetmp Perl script you can manually set the size of the tmp directory yourself, however just running the script increased the size of the tmp directory on our server from roughly 450MB to 4.0GB.

    0 讨论(0)
  • 2020-11-29 02:41
    mysqlcheck -r -f  -uroot -p   --use_frm db_name
    

    will normally do the trick

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

    Try to use limit in your query. It's because of full disk as said by @Monsters X.

    I have also faced this problem and solved by limit in query, because the thousands of records were there. Now working good :)

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

    I got this error when I set ft_min_word_len = 2 in my.cnf, which lowers the minimum word length in a full text index to 2, from the default of 4.

    Repairing the table fixed the problem.

    0 讨论(0)
提交回复
热议问题