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:
我运行一个WordPress网站。今天我发现wp_posts表崩溃了。当我试图修复表时,我收到以下错误:
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:
我试图在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?
你能告诉我还有什么办法可以解决这个问题吗?
4 个解决方案
#1
24
Turned out that "myisamchk -r -f wp_posts.MYI
" was the correct solution. I just had to go to the data folder.
原来,“myisamchk -r -f wp_posts.MYI”是正确的解决方案。我只需要去数据文件夹。
In my CentOS system, I changed directory to /var/lib/mysql/[database]/
and found wp_posts.MYI
在我的CentOS系统中,我将目录更改为/ var / lib / mysql / [database] /并找到了wp_posts.MYI
After removing this file, repair was successful.
删除此文件后,修复成功。
#2
7
Try stopping your service using the following command sudo service mysql stop
尝试使用以下命令停止服务sudo service mysql stop
Now do the repair check myisamchk -r -f -o /var/lib/mysql/DatabaseName/wp_posts
现在进行修复检查myisamchk -r -f -o / var / lib / mysql / DatabaseName / wp_posts
Start your service and enjoy it!
开始您的服务,享受它!
It works for me
这个对我有用
#3
1
Try adding the following line to your wp-config.php file:
尝试将以下行添加到wp-config.php文件中:
define( 'WP_ALLOW_REPAIR', true );
Then go to: /wp-admin/maint/repair.php
然后转到:/wp-admin/maint/repair.php
That should take effect and automatically repair your crashed table.
这应该生效并自动修复崩溃的表。
#4
0
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
):
对于mariaDB以及OS和DB版本的其他组合,该文件也可能位于/ config / databases / [DATABASE]下。尝试以root身份运行(sudo su):
service mysql stop
myisamchk -rf /config/databases/[databasename]/wp_posts.MYI
service mysql start
#1
24
Turned out that "myisamchk -r -f wp_posts.MYI
" was the correct solution. I just had to go to the data folder.
原来,“myisamchk -r -f wp_posts.MYI”是正确的解决方案。我只需要去数据文件夹。
In my CentOS system, I changed directory to /var/lib/mysql/[database]/
and found wp_posts.MYI
在我的CentOS系统中,我将目录更改为/ var / lib / mysql / [database] /并找到了wp_posts.MYI
After removing this file, repair was successful.
删除此文件后,修复成功。
#2
7
Try stopping your service using the following command sudo service mysql stop
尝试使用以下命令停止服务sudo service mysql stop
Now do the repair check myisamchk -r -f -o /var/lib/mysql/DatabaseName/wp_posts
现在进行修复检查myisamchk -r -f -o / var / lib / mysql / DatabaseName / wp_posts
Start your service and enjoy it!
开始您的服务,享受它!
It works for me
这个对我有用
#3
1
Try adding the following line to your wp-config.php file:
尝试将以下行添加到wp-config.php文件中:
define( 'WP_ALLOW_REPAIR', true );
Then go to: /wp-admin/maint/repair.php
然后转到:/wp-admin/maint/repair.php
That should take effect and automatically repair your crashed table.
这应该生效并自动修复崩溃的表。
#4
0
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
):
对于mariaDB以及OS和DB版本的其他组合,该文件也可能位于/ config / databases / [DATABASE]下。尝试以root身份运行(sudo su):
service mysql stop
myisamchk -rf /config/databases/[databasename]/wp_posts.MYI
service mysql start