MySQL 表被标记为崩溃,最后(自动?)修复失败
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8843776/
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 is marked as crashed and last (automatic?) repair failed
提问by CryptoMiningPoolSetupYiimp
I was repairing this table suddenly server hanged and when I returned back all tables are ok but this one showing 'in use' and when I try to repair it doesn't proceed.
我正在修理这张桌子时突然服务器挂了,当我回来时,所有桌子都很好,但是这张桌子显示“正在使用”,当我尝试修理时,它没有继续。
ERROR 144 - Table './extas_d47727/xzclf_ads' is marked as crashed and last (automatic?) repair failed
错误 144 - 表 './extas_d47727/xzclf_ads' 被标记为崩溃,最后(自动?)修复失败
What can I do to repair it?
我能做些什么来修复它?
回答by Aleksandar Vucetic
If your MySQL process is running, stop it. On Debian:
如果您的 MySQL 进程正在运行,请停止它。在 Debian 上:
sudo service mysql stop
Go to your data folder. On Debian:
转到您的数据文件夹。在 Debian 上:
cd /var/lib/mysql/$DATABASE_NAME
Try running:
尝试运行:
myisamchk -r $TABLE_NAME
If that doesn't work, you can try:
如果这不起作用,您可以尝试:
myisamchk -r -v -f $TABLE_NAME
You can start your MySQL server again. On Debian:
您可以再次启动您的 MySQL 服务器。在 Debian 上:
sudo service mysql start
回答by cREcker
Try running the following query:
尝试运行以下查询:
repair table <table_name>;
I had the same issue and it solved me the problem.
我有同样的问题,它解决了我的问题。
回答by crazycrv
If it gives you permission denial while moving to /var/lib/mysql then use the following solution
如果它在移动到 /var/lib/mysql 时拒绝您的权限,请使用以下解决方案
$ cd /var/lib/
$ sudo -u mysql myisamchk -r -v -f mysql/<DB_NAME>/<TABLE_NAME>
回答by Mark
I needed to add USE_FRM to the repair statement to make it work.
我需要将 USE_FRM 添加到修复语句中以使其工作。
REPAIR TABLE <table_name> USE_FRM;
回答by ThorstenS
I got myisamchk: error: myisam_sort_buffer_size is too small
as error.
我得到了myisamchk: error: myisam_sort_buffer_size is too small
错误。
The solution
解决方案
myisamchk -r -v mysql/<DB_NAME>/<TABLE_NAME> --sort_buffer_size=2G
回答by user1913891
Go to data_dir
and remove the Your_table.TMP
file after repairing <Your_table>
table.
修复表后转到data_dir
并删除Your_table.TMP
文件<Your_table>
。
回答by cryptox1
This is a 100% solution. I tried it myself.
这是一个 100% 的解决方案。我自己试过了。
myisamchk -r -v -f --sort_buffer_size=128M --key_buffer_size=128M /var/lib/mysql/databasename/tabloname
myisamchk -r -v -f --sort_buffer_size=128M --key_buffer_size=128M /var/lib/mysql/databasename/tabloname
回答by user3417257
I tried the options in the existing answers, mainly the one marked correct which did not work in my scenario. However, what did work was using phpMyAdmin. Select the database and then select the table, from the bottom drop down menu select "Repair table".
我尝试了现有答案中的选项,主要是标记为正确的选项,但在我的场景中不起作用。但是,有效的是使用 phpMyAdmin。选择数据库然后选择表,从底部的下拉菜单中选择“修复表”。
- Server type: MySQL
- Server version: 5.7.23 - MySQL Community Server (GPL)
- phpMyAdmin: Version information: 4.7.7
- 服务器类型:MySQL
- 服务器版本:5.7.23 - MySQL 社区服务器 (GPL)
- phpMyAdmin:版本信息:4.7.7