现象描述

访问 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 的解决方案的更多相关文章

  1. 解决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 ...

  2. Table XXX is marked as crashed and should be repaired问题

    数据表出错了,查询数据获取不到了. 尝试一 重启mysql service mysqld restart 没用,重启并没有把表修复掉 尝试二 check table vicidial_list;rep ...

  3. mysql 1194 – Table ‘tbl_video_info’ is marked as crashed and should be repaired 解决方法

    执行REPAIR TABLE `tbl_vedio_info`; 然后就可以了

  4. [mysql] 修复问题表Table '.xxxx' is marked as crashed and should be repaired

    程序执行的过程中,出现   Table '.xxxx' is marked as crashed and should be repaired 错误,上网查了一下,原来是表遭到损坏所致,具体修复办法如 ...

  5. 解决数据库 Table 'content_tags' is marked as crashed and should be repaired 表损坏问题

    今天突然网站TAG页面打不开了,打开debug,发现提示 Table 'content_tags' is marked as crashed and should be repaired 这样的错误 ...

  6. 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 ...

  7. mysql Table 'user' is marked as crashed and should be repaired

    myisamchk -f x:\xxxxxxxxx\MySQL\data\mysql\*.MYI

  8. Table 'hd_online' is marked as crashed and should be repaired索引损坏

    myisam 引擎表的索引损坏,解决方法 找到mysql的安装目录的/usr/local/mysql/bin/myisamchk工具,在命令行中输入: myisamchk -c -r /data/db ...

  9. Mysql中is marked as crashed and should be repaired问题的处理

    问题描述:浏览页面提示:.bbs[Table]threads' is marked as crashed and should be repaired 产生原因:表在查询或其它系统操作下损坏. 解决方 ...

随机推荐

  1. 避免nullpointer 空指针

    来自知乎: 一般在服务器返回的数据上我们会做数据合法性检测,所以在api文档上需要注明字段的取值范围,然后客户端根据这个去做数据检测,缺段就直接走数据错误的流程,这个很大程度上避免了不少nullpoi ...

  2. 想在java接口自动化里用上Python的requests?这样做就可以了

    相信现在很多的公司自动化测试重点都在接口层,因为接口测试更加接近代码底层,相对于UI自动化,接口自动化有着开发更快.覆盖更全.回报率高等优点. 接口自动化代码实现不难,本质上就是代码模拟发送请求,然后 ...

  3. [BUUOJ记录] [ACTF2020 新生赛]Upload

    简单的上传题,考察绕过前端Js验证,phtml拓展名的应用 打开题目点亮小灯泡后可以看到一个上传点 传一个php测试一下: 发现有文件拓展名检查,F12发现是Js前端验证: 审查元素直接删掉,继续上传 ...

  4. php反序列化总结与学习

    基础知识: 1.php类与对象 2.魔术函数 3.序列化方法 类与对象 <?php class test{ public $var = "hello world"; publ ...

  5. Java8 日期和时间类

    新的日期和时间API 新的日期和时间类解决了Date和Calendar类出现的问题 浅尝 LocalDate 日期类 LocalDate of = LocalDate.of(2018, 7, 13); ...

  6. leetcode刷题-60第k个队列

    题目 给出集合 [1,2,3,…,n],其所有元素共有 n! 种排列. 按大小顺序列出所有排列情况,并一一标记,当 n = 3 时, 所有排列如下: "123""132& ...

  7. go http请求流程分析

    前言 golang作为常驻进程, 请求第三方服务或者资源(http, mysql, redis等)完毕后, 需要手动关闭连接, 否则连接会一直存在; 连接池是用来管理连接的, 请求之前从连接池里获取连 ...

  8. pyhton:time模块和datetime模块

    一.time模块 1.相关定义: time模块时间的表达有3种,时间戳,时间元祖,格式化时间 #时间戳: print(time.time())#获取当前时间戳.时间戳的计算是1970纪元后经过的浮点秒 ...

  9. Win10更新后蓝牙出现故障的解决方法

    昨天Win10自动更新后,我发现我的键盘突然就不管用了,检查了一下发现原来蓝牙没有打开,同时任务栏中的蓝牙图标也不见了. 不久之前,这样的情况已经出现过了一次,那次好像更新系统后就好了,但这次是系统更 ...

  10. Ubuntu中的launcher

    最近在ubuntu系统中下载了最新版的eclipse,在一个临时文件夹中解压了eclipse压缩包,然后打开eclipse,按平时常规做法,我在launcher里右键点击eclipse,选择“锁定到启 ...