Mysql 表修复失败:“无法创建新的临时文件”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31684585/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Mysql table repair failed: "Can't create new tempfile"
提问by James Zhao
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?
你能告诉我我还能尝试解决什么问题吗?
回答by James Zhao
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.
删除此文件后,修复成功。
回答by Gabriel Rodulfo
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
这个对我有用
回答by nilsree
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.
这应该会生效并自动修复您崩溃的表。
回答by Slavik Meltser
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
回答by Curtis Maurand
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.
我只是遇到了同样的麻烦。问题是 .TMD 文件已经存在并且 mysqlrepair 拒绝覆盖它。我删除了 .TMD 文件并且 mysqlrepair 工作得非常好。我不得不停止尝试使用崩溃表的进程,然后运行修复。
回答by David F. Carr
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).
当我在 phpMyadmin 中看到这个错误时,我通过导航到 /var/lib/mysql/[database]/ 并删除我试图修复的表的 TMD 文件(不是上面解释中所述的 MYI 文件)来解决它)。
When I tried getting rid of the MYI file, the repair operation didn't work.
当我尝试删除 MYI 文件时,修复操作不起作用。