记一次Mysql的修复
现象:
生产环境的MySql无故停止,版本是5.7,启动后马上就又停止,不知道原因
错误日志如下:
InnoDB: End of page dump 2022-10-14T05:43:37.668007Z 0 [Note] InnoDB: Uncompressed page, stored checksum in field1 182295738, calculated checksums for field1: crc32 182295738/2080081071, innodb 4255406577, none 3735928559, stored checksum in field2 182295738, calculated checksums for field2: crc32 182295738/2080081071, innodb 623126066, none 3735928559, page LSN 13 1167924469, low 4 bytes of LSN at page end 1167924469, page number (if stored to page already) 590901, space id (if created with >= MySQL-4.1.1 and stored already) 261 InnoDB: Page may be an index page where index id is 439 2022-10-14T05:43:37.669825Z 0 [ERROR] [FATAL] InnoDB: Apparent corruption of an index page [page id: space=261, page number=590901] to be written to data file. We intentionally crash the server to prevent corrupt data from ending up in data files. 2022-10-14 13:43:37 0x22e8 InnoDB: Assertion failure in thread 8936 in file ut0ut.cc line 918 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.7/en/forcing-innodb-recovery.html InnoDB: about forcing recovery. 05:43:37 UTC - mysqld got exception 0x80000003 ; This could be because you hit a bug. It is also possible that this binary or one of the libraries it was linked against is corrupt, improperly built, or misconfigured. This error can also be caused by malfunctioning hardware. Attempting to collect some information that could help diagnose the problem. As this is a crash and something is definitely wrong, the information collection process might fail. key_buffer_size=8388608 read_buffer_size=131072 max_used_connections=0 max_threads=151 thread_count=0 connection_count=0 It is possible that mysqld could use up to key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 68016 K bytes of memory Hope that's ok; if not, decrease some variables in the equation. Thread pointer: 0x0 Attempting backtrace. You can use the following information to find out where mysqld died. If you see no messages after this, something went terribly wrong... 7ff6d59c49c2 mysqld.exe!my_errno() 7fff53e8ee1d MSVCR120.dll!raise() 7fff53e94a14 MSVCR120.dll!abort() 7ff6d5ae0424 mysqld.exe!?reserve@?$vector@EV?$allocator@E@std@@@std@@QEAAX_K@Z() 7ff6d5ae0601 mysqld.exe!?reserve@?$vector@EV?$allocator@E@std@@@std@@QEAAX_K@Z() 7ff6d5c1b38c mysqld.exe!?reserve@?$vector@EV?$allocator@E@std@@@std@@QEAAX_K@Z() 7ff6d5c1bfdd mysqld.exe!?reserve@?$vector@EV?$allocator@E@std@@@std@@QEAAX_K@Z() 7ff6d5aae980 mysqld.exe!?reserve@?$vector@EV?$allocator@E@std@@@std@@QEAAX_K@Z() 7ff6d5aae84d mysqld.exe!?reserve@?$vector@EV?$allocator@E@std@@@std@@QEAAX_K@Z() 7ff6d5aaf519 mysqld.exe!?reserve@?$vector@EV?$allocator@E@std@@@std@@QEAAX_K@Z() 7ff6d5ab4587 mysqld.exe!?reserve@?$vector@EV?$allocator@E@std@@@std@@QEAAX_K@Z() 7fff9bd47034 KERNEL32.DLL!BaseThreadInitThunk() 7fff9cd226a1 ntdll.dll!RtlUserThreadStart() The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains information that should help you find out what is causing the crash.
解决方法:
在ini文件里添加代码:“innodb_force_recovery=6”,示例如下
[mysqld]
port=3306
innodb_force_recovery=6
完成后启动mysql,然后使用navicat进行数据库备份
然后安装mysql8,然后再用navicat恢复