开发人员反映猎豹有个功能报500错误,让我查一下服务器上有没有做过什么调整,额,不会吧,今天元旦啊,谁会闲的蛋疼去调试服务器啊,最后他们查到了和一个表有关的sql都执行不了,
那肯定是这个表损坏了,查看数据库:
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文件的路径),修复之前记得备份哦。
[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:
[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
转载于:https://blog.51cto.com/navyaijm/1347483