Bug #87180 myisamchk repair fails if temp (.TMD) file already exists
Submitted: 25 Jul 2017 4:00 Modified: 25 Jul 2017 6:49
Reporter: Ben Marks Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: CPU Architecture:Any

[25 Jul 2017 4:00] Ben Marks
Description:
Whden attempting to repair a corrupted database file in wordpress, the wp_postmeta table could not be repaired. I sshed into the machine and ran myisamchk to repair the database table in question, getting a "temp file already exists error."

How to repeat:
Add $TABLE_NAME.TMD file to database directory

Run myisamchk -r $TABLE_NAME (Expect failure - "file already exists")

Remove file.

Run myisamchk -r $TABLE_NAMER (Expect Success)

Suggested fix:
Delete the temp file if it already exists.
[25 Jul 2017 6:49] MySQL Verification Team
Hello Ben,

Thank you for the report.
Please could you try with -f option? This will overwrite old intermediate files (files with names like tbl_name.TMD) instead of aborting. Please see https://dev.mysql.com/doc/refman/5.7/en/myisamchk-repair-options.html

Thanks,
Umesh