暴力 killall mysqld 或 kill -9 導致 MySQL 非正常關閉,再啟動報錯。
[ERROR] File './mysql-bin.000041' not found (Errcode: 13)
[ERROR] Failed to open log file
[ERROR] Can't init tc log
[ERROR] Aborting
**修復**:刪除 mysql-bin.index (索引檔),重啟自動重建:
cd /var/lib/mysql
rm -f mysql-bin.index
systemctl start mysqld
原理:.index 記錄所有 Binlog 檔案列表,啟動時逐一打開。遺失實體檔案但索引仍引用 → 報錯。刪除索引讓 MySQL 重新掃描目錄建立新索引。
[ERROR] Disk is full writing './mysql-bin.~rec~' (Errcode: 28)
**修復**:清理舊 Binlog 或擴容磁碟:
cd /var/lib/mysql
rm -f mysql-bin.000* # 非主庫或已備份可刪
# 或
mysql -e "PURGE BINARY LOGS BEFORE '2024-01-10';" # 安全清理
[ERROR] Can't start server: Bind on TCP/IP port: Address already in use
[ERROR] Do you already have another mysqld server running on port: 43306?
**排查**:
netstat -tlnp | grep 43306
ss -tlnp | grep 43306
lsof -i :43306
**修復**:
kill -9 my.cnf 換端口:port = 3307bind-address = 127.0.0.1 限制介面[Note] Recovering after a crash using mysql-bin
[ERROR] Error in Log_event::read_log_event(): 'read error'
**修復**:
1. 確認磁碟空間充足
2. innodb_force_recovery = 1 啟動讀取數據導出
3. 重建實例 (極端情況)
systemctl stop mysqld / mysqladmin shutdownexpire_logs_days 防 Binlog 爆盤innodb_force_recovery 測試恢復流程**暴力殺進程是萬惡之源,優雅關閉才是運維基本功。**