夕口技術錄

專業上的小常識,備而用之~

mysql start -> failed(mysql I/O error reading the header from the binary log)

嘗試重啟 /etc/init.d/mysql start
發現…. failed
且 /var/log/mysql.err 跟 mysql.log 竟然都是空的
於是再使用 mysqld 來啟動看看
結果是 [ERROR] mysql I/O error reading the header from the binary log

看來只好把 /var/log/mysql/mysql-bin.index 清空
再來啟動 mysqld OK

但如有 TABLE 損毀的話
[ERROR] mysqld: Table ‘./mt/mt_tbping’ is marked as crashed and should be repaired
可使用 myisamchk 來進行修改,
但要注意先先停止mysql 哦

# myisamchk -a “TABLE_NAME" 診斷錯誤類型
=================================================
# myisamchk -a apacheacct/accounting
Checking MyISAM file: apacheacct/accounting
Data records: 142266 Deleted blocks: 0
myisamchk: warning: Table is marked as crashed
myisamchk: warning: 1 client is using or hasn’t closed the table properly
– check file-size
myisamchk: warning: Size of datafile is: 5575772 Should be: 5575732
– check record delete-chain
– check key delete-chain
– check index reference
– check data record references index: 1
– check record links
myisamchk: error: Wrong bytesec: 0-0-0 at linkstart: 5575732
MyISAM-table ‘apacheacct/accounting’ is corrupted
Fix it using switch “-r" or “-o"
=================================================
再依照其建議修復資料表
# myisamchk -r apacheacct/accounting
– recovering (with sort) MyISAM-table ‘apacheacct/accounting’
Data records: 142266
– Fixing index 1
Wrong bytesec: 0- 0- 0 at 5575732; Skipped

收工

發表留言