mysql内部损坏_mysql表损坏故障案例
開發人員反映獵豹有個功能報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
總結
以上是生活随笔為你收集整理的mysql内部损坏_mysql表损坏故障案例的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: mysql 支持json_MySQL 5
- 下一篇: linux安装mysql启动失败的原因_