0

when i try to run query it is giving me error like "Incorrect key file for table '/tmp/#sql_6212_0.MYI'; try to repair it".

When i google it i found below urls and try to resolve by making some space in tmp folder but got same result.

I can't repair it as tables are Innodb.

Incorrect key file for table '/tmp/#sql_3c51_0.MYI'; try to repair it.

MySQL incorrect key file for tmp table when making multiple joins

Any help appreciate.

Community
  • 1
  • 1
Suresh Kamrushi
  • 15,627
  • 13
  • 75
  • 90

1 Answers1

0

If the repair fails because of a too small /tmp-Partition, it's because of MySQL needs the space to rebuild the index. You can try to repair the table with myisamchk and exclude individual indexes from the rebuild.

First get an overview and a description of the indexes of the table:

myisamchk --description tablename

Then include only those indexes that you want to rebuild. (Change into the database-directory on you server to issue the following command.)

myisamchk --recover -verbose --keys-used=7 tablename

If you have 4 indexes and you only want to rebuild the first 3, then use option "--keys-used" with number 7 which is decimal for binary 0111.

Optionally use -f (--force) to do a repair operation automatically if myisamchk finds any errors.

MySQL deactivates excluded indexes.

elim
  • 1,404
  • 1
  • 16
  • 17
  • Quoting: *I can't repair it as tables are Innodb.* This is happening on a temporary table. (I'm here because I have the same problem.) – reinierpost Jan 11 '18 at 10:55