Updated: 11 October 2026 · Applies to: MariaDB 10.6 to 11.4 and MySQL 8
"Can't create new tempfile" during a repair usually means a temporary repair file is left over from an earlier attempt, or there is not enough free disk space.
Fix (root, VPS or dedicated server)
- Check free space:
df -h /var/lib/mysql /tmp. Free some space if a disk is full. - Look for a leftover
.TMDfile next to the table, for example/var/lib/mysql/shopdb/orders.TMD. Move it out of the way. - Run the repair again:
mysqlcheck -r shopdb orders.
If it still fails, stop the database server and repair the MyISAM table files directly, forcing the old temporary file to be overwritten:
myisamchk -r -f /var/lib/mysql/shopdb/orders.MYI
Note: Never run myisamchk while the database server is using the table. Back up the database folder first.