【MySQL Errors】Table 'xxx' is marked as crashed and should be repaired 的解决方案
现象描述
访问 Zabbix Web,出现如下错误提示:
• Error in query [SELECT * FROM history_uint h WHERE h.itemid='25067' ORDER BY h.clock DESC LIMIT 1 OFFSET 0] [Table './zabbix/history_uint' is marked as crashed and should be repaired]
• Error in query [SELECT * FROM history_uint h WHERE h.itemid='26280' ORDER BY h.clock DESC LIMIT 1 OFFSET 0] [Table './zabbix/history_uint' is marked as crashed and should be repaired]
• Error in query [SELECT * FROM history_uint h WHERE h.itemid='26286' ORDER BY h.clock DESC LIMIT 1 OFFSET 0] [Table './zabbix/history_uint' is marked as crashed and should be repaired]
解决办法
1、首先进入mysql命令台:
mysql -u root -p
回车,然后输入密码
2、查询所有的库
mysql> show databases;
3、进入数据库“zabbix”是库名
mysql> use zabbix;
4、检查表
check table history_uint;
(history_uint :出现错误的表)用来检查出现问题的表的状态,出现错误就正常。
mysql> check table history_uint;
+---------------------+-------+----------+-------------------------------------------------------+
| Table | Op | Msg_type | Msg_text |
+---------------------+-------+----------+-------------------------------------------------------+
| zabbix.history_uint | check | warning | Table is marked as crashed |
| zabbix.history_uint | check | warning | 1 client is using or hasn't closed the table properly |
| zabbix.history_uint | check | error | record delete-link-chain corrupted |
| zabbix.history_uint | check | error | Corrupt |
+---------------------+-------+----------+-------------------------------------------------------+
4 rows in set (2 min 48.75 sec)
5、修复表
repair table history_uint;
mysql> repair table history_uint;
+---------------------+--------+----------+--------------------------------------------------+
| Table | Op | Msg_type | Msg_text |
+---------------------+--------+----------+--------------------------------------------------+
| zabbix.history_uint | repair | warning | Number of rows changed from 28813609 to 28843608 |
| zabbix.history_uint | repair | status | OK |
+---------------------+--------+----------+--------------------------------------------------+
2 rows in set (9 min 12.42 sec)
6、再次检查表。
check table history_uint;
mysql> check table history_uint;
+---------------------+-------+----------+----------+
| Table | Op | Msg_type | Msg_text |
+---------------------+-------+----------+----------+
| zabbix.history_uint | check | status | OK |
+---------------------+-------+----------+----------+
1 row in set (13.57 sec)
7、ok 搞定。
预防措施
1、一定要备份一次数据库,起码保留了表结构,有些可有可无的数据,可以直接覆盖。
2、重要的数据要经常注意备份,一般一个月左右备份一次。
3、出现此类错误,一般能够解决,经上面的修复方法是比较可行的。但偶尔会有数据丢失的情况,强烈建议先备份。
Windows下使用MyISAM存储引擎碰到此问题的解决方法
首先需要定位到你的mysql的bin目录,里面包含myisamchk.exe文件的目录
./myisamchk -c -r 数据库表MYI文件的路径 (例如:D:/mysql/data/hangban/user.MYI)
如果还不行,就-f 强制修复
D:\mysql\bin> cd .. 返回上级目录
D:\mysql> cd data 进入数据库所在目录(mysql的数据库文件都是放在data这个目录里面的)
D:\mysql\data> cd hangban 进入数据库,windows服务器中数据库就是一个文件夹(这里以hangban为例子)
D:\mysql\data\hangban> myisamchk -r user
- recovering (with sort) MyISAM-table 'user'
Data records: 7216
- Fixing index 1
- Fixing index 2
- Fixing index 3
D:\mysql\data\hangban>
user为数据库的表名,提示哪个表错误,就修复哪个表。
【MySQL Errors】Table 'xxx' is marked as crashed and should be repaired 的解决方案的更多相关文章
- 解决mysql Table ‘xxx’ is marked as crashed and should be repaired的问题。
解决mysql Table 'xxx' is marked as crashed and should be repaired的问题. 某个表在进行数据插入和更新时突然出现Table 'xxx' is ...
- Table XXX is marked as crashed and should be repaired问题
数据表出错了,查询数据获取不到了. 尝试一 重启mysql service mysqld restart 没用,重启并没有把表修复掉 尝试二 check table vicidial_list;rep ...
- mysql 1194 – Table ‘tbl_video_info’ is marked as crashed and should be repaired 解决方法
执行REPAIR TABLE `tbl_vedio_info`; 然后就可以了
- [mysql] 修复问题表Table '.xxxx' is marked as crashed and should be repaired
程序执行的过程中,出现 Table '.xxxx' is marked as crashed and should be repaired 错误,上网查了一下,原来是表遭到损坏所致,具体修复办法如 ...
- 解决数据库 Table 'content_tags' is marked as crashed and should be repaired 表损坏问题
今天突然网站TAG页面打不开了,打开debug,发现提示 Table 'content_tags' is marked as crashed and should be repaired 这样的错误 ...
- azkaban-web-start.sh启动时出现Table 'execution_flows' is marked as crashed and should be repaired Query错误的解决办法(图文详解)
问题详情 [hadoop@master bin]$ ./azkaban-web-start.sh Using Hadoop Using Hive from /home/hadoop/app/hive ...
- mysql Table 'user' is marked as crashed and should be repaired
myisamchk -f x:\xxxxxxxxx\MySQL\data\mysql\*.MYI
- Table 'hd_online' is marked as crashed and should be repaired索引损坏
myisam 引擎表的索引损坏,解决方法 找到mysql的安装目录的/usr/local/mysql/bin/myisamchk工具,在命令行中输入: myisamchk -c -r /data/db ...
- Mysql中is marked as crashed and should be repaired问题的处理
问题描述:浏览页面提示:.bbs[Table]threads' is marked as crashed and should be repaired 产生原因:表在查询或其它系统操作下损坏. 解决方 ...
随机推荐
- C++——百分率
代码如下: #include <iostream> #include <cmath> using namespace std; int main() { double a; c ...
- IE9 报错 script1004缺少“;”
在IE9中不支持 let关键字,修改为var就可以了 作者:彼岸舞 时间:2020\07\31 内容关于:工作中用到的小技术 本文来源于网络,只做技术分享,一概不负任何责任
- 沉珂日重的Java项目 Spring真的帮到我们了吗?
开局三连图. 这是刚开始时的程序结构,虽清晰已经有混乱的前兆. 业务增加,人员增加后就会沉珂日重. 几年后,最后的模样会让使用者和维护者都很无奈. 人们喜欢把Java程序的层次结构比作建筑,实际却最像 ...
- 借助rownum中求Oracle表中前三名(三甲:状元榜眼探花)的方法(总计三种方法,以讲述rownum的使用为主)
要求前三名,MySQL中有order by排序,limit限制数量,结果很容易得到,而且limit的执行顺序也在order by之后,写出的sql高效易懂而不易出错. 但在oracle中,由于没有li ...
- 获取.properties配置文件属性值
public class TestProperties { /** * * @Title: printAllProperty * @Description: 输出所有配置信息 * @param pro ...
- java 将map转为实体类
使用反射将map转为对象,如果不使用反射的话需要一个get一个set写起来麻烦,并且不通用,所以写了一个通用的方法将map集合转为对象,直接看代码,注释也都挺清楚的 public static < ...
- VUE常用问题hack修改
vue-router router这里踩的坑主要是组件的重用.构建单页面大型应用的话,肯定要开启组件的缓存的,因为一般会要求后退的时候不要重新加载页面,而且要记住原始的滚动位置.首先,引入router ...
- SpringMVC执行流程源码分析
SpringMVC执行流程源码分析 我们先来看张图片,帮助我们理解整个流程 然后我们开始来解析 首先SpringMVC基于Servlet来运行 那么我们首先来看HttpServletBean这个类 他 ...
- 大揭秘| 我司项目组Gitlab Flow && DevOps流程
长话短说,本文全景呈现我司项目组gitlab flow && devops Git Flow定义了一个项目发布的分支模型,为管理具有预定发布周期的大型项目提供了一个健壮的框架. Dev ...
- x86-TSO : 适用于x86体系架构并发编程的内存模型
Abstract : 如今大数据,云计算,分布式系统等对算力要求高的方向如火如荼.提升计算机算力的一个低成本方法是增加CPU核心,而不是提高单个硬件工作效率. 这就要求软件开发者们能准确,熟悉地运用高 ...