Chinaunix首页 | 论坛 | 博客
  • 博客访问: 296334
  • 博文数量: 57
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 1474
  • 用 户 组: 普通用户
  • 注册时间: 2013-07-25 10:56
文章分类
文章存档

2014年(25)

2013年(32)

分类: Mysql/postgreSQL

2014-01-02 17:32:32

开发人员反映猎豹有个功能报500错误,让我查一下服务器上有没有做过什么调整,额,不会吧,今天元旦啊,谁会闲的蛋疼去调试服务器啊,最后他们查到了和一个表有关的sql都执行不了,
那肯定是这个表损坏了,查看数据库:

1
2
3
4
5
6
7
8
mysql> use xx_sync
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> desc extension_1;
ERROR 145 (HY000): Table './xx_sync/extension_1' is marked as crashed and should be repaired
mysql> quit
Bye

靠,果然损坏了,修复吧,(myisamchk  -r 数据库表MYI文件的路径),修复之前记得备份哦。

1
2
3
4
5
6
7
8
[root@yw_db_yj xx_sync]#  ./bmyisamchk -r db/xx_sync/extension_1.MYI
- recovering (with sort) MyISAM-table 'db/xx_sync/extension_1.MYI'
Data records: 101539
- Fixing index 1
myisamchk: warning: Duplicate key for record at   26664372 against record at   16160720
- Fixing index 2
Data records: 101538
myisamchk: warning: 1 records have been removed

PS:如果这样还不行那就加-f 参数强制修复

看一下是否修复ok:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
[root@yw_db_yj xx_sync]#  ./bin/mysql -uroot -p123456 --sock=logs/mysql.sock
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 549105657
Server version: 5.5.15-log Source distribution
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use xx_sync
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> desc extension_1;
+------------+-------------+------+-----+---------+----------------+
| Field      | Type        | Null | Key | Default | Extra          |
+------------+-------------+------+-----+---------+----------------+
| id         | int(11)     | NO   | PRI | NULL    | auto_increment |
| passport   | varchar(64) | YES  | UNI | NULL    |                |
| content    | longtext    | NO   |     | NULL    |                |
| checkcode  | varchar(45) | YES  |     | NULL    |                |
| createtime | int(11)     | YES  |     | NULL    |                |
| updatetime | int(11)     | YES  |     | NULL    |                |
+------------+-------------+------+-----+---------+----------------+
6 rows in set (0.02 sec)
mysql> quit
Bye
阅读(1843) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~