我的第一個問題在stackoverflow,所以我希望我已遵循所有的指導方針。MySQL錯誤密鑰文件不正確。 myisamchk修復工作,但表腐敗很快
我有一個數字海洋液滴MySql數據庫的網站。
我發現mysql已停止運行,查找後發現損壞的表。用myisamchk -r
修復後,我認爲問題解決了。但是它一直在發生。我改變innodb_buffer_pool_size = 20M in my.cnf
和創造上/dev/vda/
一些自由空間閱讀本MySQL, Error 126: Incorrect key file for table
Filesystem 1K-blocks Used Available Use% Mounted on
udev 239664 4 239660 1% /dev
tmpfs 50176 380 49796 1% /run
/dev/vda1 20511356 12346408 7099992 64%/
none 4 0 4 0% /sys/fs/cgroup
none 5120 0 5120 0% /run/lock
none 250872 0 250872 0% /run/shm
後,我有這些錯誤了MySQL/error.log中
[ERROR] /usr/sbin/mysqld: Incorrect key file for table './websitename/wp_options.MYI'; try to repair it
[ERROR] Got an error from thread_id=178, /build/mysql-5.5-heGK82/mysql-5.5-5.5.55/storage/myisam/mi_update.c:226
[ERROR] MySQL thread id 178, OS thread handle 0x7f4544010700, query id 69124 localhost th3489075 Updating
當我對損壞的表我跑myisamchk db_name.MYI
得到
Checking MyISAM file: wp_options.MYI
Data records: 375 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: error: Size of datafile is: 1059228 Should be: 1059276
- check record delete-chain
- check key delete-chain
- check index reference
- check data record references index: 1
- check data record references index: 2
- check record links
myisamchk: error: Keypointers and record positions doesn't match
myisamchk: warning: Found 375 key parts. Should be: 377
MyISAM-table 'wp_options.MYI' is corrupted
Fix it using switch "-r" or "-o"
修復表myisamchk -r or -o
選項似乎運行工作myisamchk *.MYI
立即報告沒有問題,但稍後它返回上述錯誤。
我有數據庫的各種備份,但我不確定它們與現有的不同。
我明白如果mysql正在運行,會發生警告myisamchk: warning: 1 client is using or hasn't closed the table properly
。
當mysql停止時myisamchk *.MYI
報告都可以,但mysql仍然崩潰。
謝謝里克,是的,我聽說Innodb更健壯,有些事情要牢記未來。今天和一個伴侶聊天,他建議傾銷數據庫並導入它。到目前爲止,這是沒有錯誤的運行。我也會記住OPTIMIZE TABLE方法。 – r4debe