表现:
服务器数据库查询很慢,莫名数据库服务崩溃
问题排查过程:
按照网上操作,配置my.ini ,添加error-log参数,重启mysql,查看错误日志
按照错误日志内容,搜索可能的错误问题
比如我的报错是:
221026 14:35:35 [Note] C:\Program Files (x86)\MySQL\MySQL Server 5.5\bin\mysqld: ready for connections.
Version: '5.5.35-log' socket: '' port: 3306 MySQL Community Server (GPL)
InnoDB: Error: trying to access page number 4294851967 in space 0,
InnoDB: space name .\ibdata1,
InnoDB: which is outside the tablespace bounds.
InnoDB: Byte offset 0, len 16384, i/o type 10.
InnoDB: If you get this error at mysqld startup, please check that
InnoDB: your my.cnf matches the ibdata files that you have in the
InnoDB: MySQL server.
221026 14:37:09 InnoDB: Assertion failure in thread 10012 in file fil0fil.c line 4578
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
几乎每隔1分钟,mysql重启一次
解决方案是说数据库损坏,需要修复
问题解决过程:
备份数据库文件(很必要)
设置my.ini 中的innodb_force_recovery =1
重启mysql,将原有数据导出,如果不行就修改上面的值,一点一点改大,直到导出不报错
卸载mysql,删除原数据库文件
重装mysql,创建新的数据库文件,导入原有数据 至此修复完成