解决 MySQL 的 Table is marked as crashed and should be repaired 问题
周末有网友反馈微信群网站无法打开,出现错误,打开服务器初步查看,发现是数据库服务未启动导致,启动服务后恢复正常。本以为问题得到解决,周一又有用户反馈网站用户无法注册、无法登录。
于是查看服务器事件,发现mysql错误提示:bin\mysqld.exe: Table '.\wxgroups\ice_members' is marked as crashed and should be repaired
打开cmd命令窗口,mysql -uroot -p wxgroups 发现其中有三个表损坏
使用命令:mysql -uroot -p wxgroups --auto-repair进行修复即可(修复前务必备份数据库,停止数据库进行修复)
wxgroups.ice_member
warning : Table is marked as crashed
warning : 1 client is using or hasn't closed the table properly
error : Size of indexfile is: 1794048 Should be: 1796096
error : Corrupt
事件回顾:为什么会出现数据库莫名的损坏?
初步判定为数据库可用磁盘空间不足(一度为0)导致数据表出现问题。
php-cgi进程过多修改fcgiext.ini文件
建议
512M 内存的改maxInstances=50
1G 内存的改maxInstances=80
2G 内存的改maxInstances=140
再修改
InstanceMaxRequests=
把这个值改小
建议
512M 内存的改InstanceMaxRequests=200
1G 内存的改InstanceMaxRequests=300
2G 内存的改InstanceMaxRequests=500
改完, 重启IIS。