PC崩溃后Xampp mysql innodb恢复失败

时间:2014-03-05 10:23:33

标签: php mysql xampp innodb

所以我有几次遇到这个问题。我没有意识到为什么会发生这种情况我只是知道重新启动后,mysql将无法启动。

所以我重新安装xampp并乱搞几次,直到我得到它的工作。上次发生这种情况时,我查看了mysql.err文件,发现错误是关于损坏的文件。所以我删除了那些数据库并启动了mysql

但今天我看到了正确的理由。当它突然被冻结并重新启动时,我坐在电脑前。之后mysql将无法启动。

查看我的localhost / xampp状态页面,它说mysql已停用

我们去检查日志,实际上是mysql.err文件,然后它表示从崩溃中恢复并且innodb无法从崩溃中恢复。

以下是日志

2014-03-05 11:18:11 7829 mysqld_safe Starting mysqld daemon with databases from  /opt/lampp/var/mysql
2014-03-05 11:18:11 0 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
2014-03-05 11:18:11 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2014-03-05 11:18:11 8235 [Note] Plugin 'FEDERATED' is disabled.
2014-03-05 11:18:11 8235 [Note] InnoDB: The InnoDB memory heap is disabled
2014-03-05 11:18:11 8235 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2014-03-05 11:18:11 8235 [Note] InnoDB: Compressed tables use zlib 1.2.8
2014-03-05 11:18:11 8235 [Note] InnoDB: Not using CPU crc32 instructions
2014-03-05 11:18:11 8235 [Note] InnoDB: Initializing buffer pool, size = 16.0M
2014-03-05 11:18:11 8235 [Note] InnoDB: Completed initialization of buffer pool
2014-03-05 11:18:11 8235 [Note] InnoDB: Highest supported file format is Barracuda.
2014-03-05 11:18:11 8235 [Note] InnoDB: The log sequence numbers 11011943 and 11011943 in ibdata files do not match the log sequence number 11012198 in the ib_logfiles!
2014-03-05 11:18:11 8235 [Note] InnoDB: Database was not shutdown normally!
2014-03-05 11:18:11 8235 [Note] InnoDB: Starting crash recovery.
2014-03-05 11:18:11 8235 [Note] InnoDB: Reading tablespace information from the .ibd   files...
2014-03-05 11:18:11 8235 [ERROR] InnoDB: Attempted to open a previously opened  tablespace. Previous tablespace wpdemo/wp_terms uses space ID: 93 at filepath: ./wpdemo/wp_terms.ibd. Cannot open tablespace wordpress/wp_evg_feeds which uses space ID: 93 at filepath: ./wordpress/wp_evg_feeds.ibd
2014-03-05 11:18:11 7f3ca4a11700  InnoDB: Operating system error number 2 in a file operation.
InnoDB: The error means the system cannot find the path specified.
InnoDB: If you are installing InnoDB, remember that you must create
InnoDB: directories yourself, InnoDB does not create them.
InnoDB: Error: could not open single-table tablespace file ./wordpress/wp_evg_feeds.ibd
InnoDB: We do not continue the crash recovery, because the table may become
InnoDB: corrupt if we cannot apply the log records in the InnoDB log to it.
InnoDB: To fix the problem and start mysqld:
InnoDB: 1) If there is a permission problem in the file and mysqld cannot
InnoDB: open the file, you should modify the permissions.
InnoDB: 2) If the table is not needed, or you can restore it from a backup,
InnoDB: then you can remove the .ibd file, and InnoDB will do a normal
InnoDB: crash recovery and ignore that table.
InnoDB: 3) If the file system or the disk is broken, and you cannot remove
InnoDB: the .ibd file, you can set innodb_force_recovery > 0 in my.cnf
InnoDB: and force InnoDB to continue crash recovery here.
2014-03-05 11:18:11 7829 mysqld_safe mysqld from pid file /opt/lampp/var/mysql/aleksandar-PC.pid ended

上次当我收到错误时我没有意识到这是因为电脑死机而且我不需要文件,所以我只是删除了损坏的数据库文件并启动了mysql。问题是现在我不能删除任何文件,我需要这些数据库回来工作。 有什么建议吗?

1 个答案:

答案 0 :(得分:0)

因此将损坏的文件重命名为例如wp_terms.ibd.bkp,以便mysql可以跳过这些表并开始。现在,当mysql恢复并启动时,我会定期关闭它。将重命名的.bkp文件重命名为普通表文件并重新启动mysql。现在,当mysql定期关闭时,它不会检查恢复并正常启动。应该被破坏的文件现在正在运行。一切都恢复正常。多么合乎逻辑!