简体   繁体   English

MySQL说:#1194-表'tablename'被标记为已崩溃,应该修复

[英]MySQL said: #1194 - Table 'tablename' is marked as crashed and should be repaired

If tables are crashing it means something is wrong with my system. 如果表崩溃了,则意味着我的系统出了点问题。

MySQL said: 

#1194 - Table 'tablename' is marked as crashed and should be repaired 

My website is currently down because of this. 因此,我的网站目前关闭。

I know how to repair table from phpmyadmin but is it safe way to repair? 我知道如何从phpmyadmin修复表,但是它是安全的修复方法吗?

What is the important factor for this issue? 这个问题的重要因素是什么?

Question. 题。 Generally, Why table get crashed? 通常,为什么表会崩溃?

Answers. 答案。 These may be the reasons - 这些可能是原因-

  1. Server's disk space was full. 服务器的磁盘空间已满。 (Please check disk space in live server) (请检查活动服务器中的磁盘空间)

  2. Incorrect shutdown MySQL server/Improperly closing the tables while using the databases. 错误关闭MySQL服务器/使用数据库时不正确地关闭表。

  3. More server load. 更多服务器负载。

First of all - there are many reasons for a crashed table. 首先-导致表崩溃的原因很多。

  • harddisk failure 硬盘故障
  • sudden server reboot 服务器突然重启
  • server crash 服务器崩溃
  • firmware problems (raid controller or bios) 固件问题(raid控制器或BIOS)
  • defects in the cabling 布线中的缺陷
  • etc. 等等

A repair with phpmyadmin does basically the same as the mysqlrepair commandline. 使用phpmyadmin进行的修复与mysqlrepair命令行基本相同。 I would suggest to repair everything on command line: 我建议修复命令行上的所有内容:

mysqlrepair -A --auto-repair
mysqlrepair -A -o

Or start a test: 或开始测试:

mysqlrepair -A -c

如果您不需要命令行工具,并且崩溃的原因很可能是MYSQL本身,请从MYSQL运行此命令来修复表:

REPAIR TABLE db_name.table_name;

是的,您可以从phpmyadmin修复表,这不会影响您的数据,还可以使用“ myisamchk”命令从Shell修复表。

Use: 使用:

mysqlcheck -u root -p --auto-repair --check --all-databases
(Password prompted)

Enter MySQL password for user root and everything is done. 输入root用户的MySQL密码,一切就完成了。

我从命令行使用它:

mysqlcheck -u root -p --auto-repair --check --optimize --all-databases

Solution : 解决方案:

Just go to database and select table which has problem and select "repair table" option it will fix crash entries in table and solve your problem 只需进入数据库并选择有问题的 ,然后选择“修复表”选项 ,它将修复表中的崩溃条目并解决您的问题

在此处输入图片说明

If you have ssh access to server you can log in and then execute: 如果您具有对服务器的ssh访问权限,则可以登录然后执行:

df -h

and you could see something like this: 您会看到类似以下内容:

Filesystem            Size  Used Avail Use% Mounted on
/dev/cciss/xxxx      19G  825M   18G   5% /
/dev/cciss/xxxx     9.4G  4.8G  4.2G  54% /usr
/dev/cciss/xxxx      15G  1.8G   12G  13% /var
/dev/cciss/xxxx      19G   18G    0G   0% /opt
/dev/cciss/xxxx     4.7G  243M  4.3G   6% /tmp
/dev/cciss/xxxx     9.4G  1.5G  7.5G  17% /home

It's LAMP installed on /opt , after having some free disk space, you can run the query (as above was wrote): 它是LAMP安装在/opt ,在拥有一些可用磁盘空间之后,您可以运行查询(如上所述):

Repair table db.mytablecrashed

And you get in the last row: 然后进入最后一行:

Table               OP        Msg_type  Msg_text
...
db.mytablecrashed   repair    status    OK

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM