我的 MySQL 4.1 Windows 服务有时会崩溃,日志中会出现以下几行:
091218 9:31:25 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
091218 9:31:33 InnoDB: Starting log scan based on checkpoint at
InnoDB: log sequence number 2 817025450.
InnoDB: Doing recovery: scanned up to log sequence number 2 817025450
091218 9:31:35 InnoDB: Flushing modified pages from the buffer pool...
091218 9:31:35 InnoDB: Started; log sequence number 2 817025450
C:\Programme\MySQL\MySQL Server 4.1\bin\mysqld-nt: ready for connections.
Version: '4.1.14-nt' socket: '' port: 3306 Official MySQL binary
100107 9:02:51 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
100107 9:02:53 InnoDB: Starting log scan based on checkpoint at
InnoDB: log sequence number 2 953338420.
InnoDB: Doing recovery: scanned up to log sequence number 2 953338420
100107 9:02:53 InnoDB: Flushing modified pages from the buffer pool...
100107 9:02:53 InnoDB: Started; log sequence number 2 953338420
C:\Programme\MySQL\MySQL Server 4.1\bin\mysqld-nt: ready for connections.
Version: '4.1.14-nt' socket: '' port: 3306 Official MySQL binary
这些信息并未指出任何具体问题。我该怎么做才能追踪崩溃的根源?
答案1
停止数据库
转储(或备份)您的数据库。
删除数据(Windows)或 /var(UNIX)目录中的所有内容。
重新启动数据库(现在数据库将启动)
恢复mysql目录。
停止数据库
恢复其他数据库和表
启动数据库
答案2
我相信您需要设置innodb_force_recovery=2
并执行 mysql 转储,删除原始数据库目录并使用导入重新创建它。本文有更详细的步骤。