当 MySQL 服务器无法启动时恢复 MySQL 数据库

当 MySQL 服务器无法启动时恢复 MySQL 数据库

我的 Windows Server 2003 昨天下午断电了。重启服务器后,MySQL 5.0 数据库无法启动。我检查了错误日志,发现访问 ibdata1 文件中的页面时出错。还有一个断言失败,表明我需要启用 innodb_force_recovery。我试了一下,并将值设置为 4、5、6 和 8。每次 mysql 服务器都无法启动。我看到了 innodb-tools这里但似乎我需要至少部分功能的 mysql 实例才能使它们工作。

我至少需要从表中恢复数据。最近的备份不包含我需要恢复的所有内容。到目前为止我看到的一切都表明我运气不佳。我想看看是否有人可以给我指明正确的方向。

以下是相关的错误日志条目:

InnoDB: The user has set SRV_FORCE_NO_LOG_REDO on
InnoDB: Skipping log redo
InnoDB: Error: trying to access page number 4294965119 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.
091015 18:46:22InnoDB: Assertion failure in thread 4648 in file .\fil\fil0fil.c line     3959
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.0/en/forcing-recovery.html
InnoDB: about forcing recovery.
091015 18:46:22 [ERROR] C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqld-nt: Got signal 11. Aborting!

091015 18:46:22 [ERROR] Aborting

091015 18:46:22 [Note] C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqld-nt: Shutdown complete

配置文件:

[client]
port=3306
[mysql]    
default-character-set=latin1
[mysqld]
innodb_force_recovery = 8
port=3306
basedir="C:/Program Files/MySQL/MySQL Server 5.0/"
datadir="C:/Program Files/MySQL/MySQL Server 5.0/Data/"
default-character-set=latin1
default-storage-engine=INNODB
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
max_connections=100
query_cache_size=0
table_cache=256
tmp_table_size=103M
thread_cache_size=8
#*** MyISAM Specific options
myisam_max_sort_file_size=100G
myisam_max_extra_sort_file_size=100G
myisam_sort_buffer_size=205M
key_buffer_size=175M
read_buffer_size=64K
read_rnd_buffer_size=256K
sort_buffer_size=256K
#*** INNODB Specific options ***
innodb_additional_mem_pool_size=7M
innodb_flush_log_at_trx_commit=1
innodb_log_buffer_size=3498K
innodb_buffer_pool_size=339M
innodb_log_file_size=170M
innodb_thread_concurrency=8

答案1

看一眼http://bugs.mysql.com/bug.php?id=16827。这听起来很像您的错误。在这种情况下,根本原因是意外更改了配置。如果您有配置文件的备份,您可以将其与当前配置文件进行比较。

如果您不确定要查找什么,请发布 my.cnf 的副本和 mysql 数据目录中的文件列表。

相关内容