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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16915604/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 11:52:48  来源:igfitidea点击:

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

phpmysqlsqlphpmyadmin

提问by Javascript Coder

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.

  3. More server load.

  1. 服务器的磁盘空间已满。(请检查实时服务器的磁盘空间)

  2. 错误关闭 MySQL 服务器/在使用数据库时不正确关闭表。

  3. 更多的服务器负载。

回答by Andreas Rehm

First of all - there are many reasons for a crashed table.

首先 - 表崩溃的原因有很多。

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

A repair with phpmyadmin does basically the same as the mysqlrepair commandline. I would suggest to repair everything on command line:

使用 phpmyadmin 进行修复与使用 mysqlrepair 命令行基本相同。我建议在命令行上修复所有内容:

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

Or start a test:

或者开始测试:

mysqlrepair -A -c

回答by Dmitry Verhoturov

If you don't have commandline tools needed, and reason for crash is most likely is MYSQL itself, run this from MYSQL to repair a table:

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

REPAIR TABLE db_name.table_name;

回答by Bobbin Zachariah

Yes you can repair table from phpmyadmin, it will not affect your data and you can also repair table from shell with 'myisamchk' command.

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

回答by Abhishek Sharma

Use:

用:

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

Enter MySQL password for user root and everything is done.

为用户 root 输入 MySQL 密码,一切就完成了。

回答by Hassan Saeed

Solution :

解决方案 :

Just go to database and select tablewhich has problem and select "repair table" optionit will fix crash entries in table and solve your problem

只需转到数据库并选择有问题的选择“修复表”选项,它将修复表中的崩溃条目并解决您的问题

enter image description here

在此处输入图片说明

回答by bgarlock

I use this from the command line:

我从命令行使用它:

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

回答by Rodney Salcedo

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