How do you fix a MySQL “Incorrect key file” error when you can't repair the table?

前端 未结 10 1900
眼角桃花
眼角桃花 2020-12-13 08:53

I\'m trying to run a rather large query that is supposed to run nightly to populate a table. I\'m getting an error saying Incorrect key file for table \'/var/tmp/#sql

10条回答
  •  伪装坚强ぢ
    2020-12-13 09:39

    You'll need to run this command from the MySQL prompt:

    REPAIR TABLE tbl_name USE_FRM;
    

    From MySQL's documentation on the Repair command:

    The USE_FRM option is available for use if the .MYI index file is missing or if its header is corrupted. This option tells MySQL not to trust the information in the .MYI file header and to re-create it using information from the .frm file. This kind of repair cannot be done with myisamchk.

提交回复
热议问题