15
I run a WordPress website. Today I found that wp_posts table is crashed. When I tried to repair the table, I got the following error:
REPAIR TABLE wp_posts;
error Can't create new tempfile: './[databasename]/wp_posts.TMD'
repair status Operation failed
I tried to run the following command in shell:
myisamchk -r -f wp_posts.MYI
error: File 'wp_posts.MYI' doesn't exist
Can you please tell me what else I can try to fix this problem?
Turned out that “myisamchk -r -f wp_posts.MYI
” was the correct solution. I just had to go to the data folder.
In my CentOS system, I changed directory to /var/lib/mysql/[database]/
and found wp_posts.MYI
After removing this file, repair was successful.
worked for me too! But, someone knows why this happens? I dont wanna do this again hahahah
–
Try stopping your service using the following command sudo service mysql stop
Now do the repair check myisamchk -r -f -o /var/lib/mysql/DatabaseName/wp_posts
Start your service and enjoy it!
It works for me
This is magic. Thank you s much! You saved me. I tried. sudo myisamchk -r -f -o /var/lib/mysql/[dbname]/wp_options
–
Try adding the following line to your wp-config.php file:
define( 'WP_ALLOW_REPAIR', true );
Then go to: /wp-admin/maint/repair.php
That should take effect and automatically repair your crashed table.
Thank you very much for your answer
–
Once you’ve done the repair, do not forget to remove this line from your wp-config.php file. The URL /wp-admin/maint/repair.php is accessible by non authenticated users.
–
For mariaDB and some other combination of OS and DB version, the file may also be located under /config/databases/[DATABASE]
.
Try to run as root (sudo su
):
service mysql stop
myisamchk -rf /config/databases/[databasename]/wp_posts.MYI
service mysql start
I just had the same trouble. The problem was the .TMD file already existed and mysqlrepair refused to overwrite it. I removed the .TMD file and the mysqlrepair worked famously. I had to stop the process attempting to use the crashed table, then run the repair.
When I saw this error in phpMyadmin, I got around it by navigating to /var/lib/mysql/[database]/ and deleting the TMD file for the table I was trying to repair (not the MYI file as stated in the explanation above).
When I tried getting rid of the MYI file, the repair operation didn’t work.
source : https://stackoverflow.com/questions/31684585/mysql-table-repair-failed-cant-create-new-tempfile