服务中缺少MySql - 无法打开innodb_index_stats.ibd

时间:2018-01-05 12:23:50

标签: mysql innodb ampps

我在Windows 10上安装了Ampps 3.7,而Apache运行正常,Mysql将不再启动;它用于运行正常但现在有一个innidb错误。我的问题类似于问题here,除了我没有升级mysql,建议的解决方案是删除并恢复几个inno_db表。但是当我无法连接到mysql时,我怎么能这样做

我已阅读thisthis,他们都说将以下内容添加到my.ini

innodb_force_recovery = 1

Ampps Mysql错误日志说:

2018-01-05 12:17:46 11096 [Warning] You need to use --log-bin to make --binlog-format work.
2018-01-05 12:17:46 11096 [Note] Plugin 'FEDERATED' is disabled.
2018-01-05 12:17:46 11096 [Note] InnoDB: Using atomics to ref count buffer pool pages
2018-01-05 12:17:46 11096 [Note] InnoDB: The InnoDB memory heap is disabled
2018-01-05 12:17:46 11096 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2018-01-05 12:17:46 11096 [Note] InnoDB: Memory barrier is not used
2018-01-05 12:17:46 11096 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-01-05 12:17:46 11096 [Note] InnoDB: Not using CPU crc32 instructions
2018-01-05 12:17:46 11096 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2018-01-05 12:17:46 11096 [Note] InnoDB: Completed initialization of buffer pool
2018-01-05 12:17:46 11096 [Note] InnoDB: Highest supported file format is Barracuda.
2018-01-05 12:17:46 11096 [Note] InnoDB: The log sequence numbers 1600637 and 1600637 in ibdata files do not match the log sequence number 3531342 in the ib_logfiles!
2018-01-05 12:17:46 11096 [Note] InnoDB: Database was not shutdown normally!
2018-01-05 12:17:46 11096 [Note] InnoDB: Starting crash recovery.
2018-01-05 12:17:46 11096 [Note] InnoDB: Reading tablespace information from the .ibd files...
2018-01-05 12:17:46 11096 [ERROR] InnoDB: Attempted to open a previously opened tablespace. Previous tablespace invoiceplane/ip_invoice_custom uses space ID: 2 at filepath: .\invoiceplane\ip_invoice_custom.ibd. Cannot open tablespace mysql/innodb_index_stats which uses space ID: 2 at filepath: .\mysql\innodb_index_stats.ibd
InnoDB: Error: could not open single-table tablespace file .\mysql\innodb_index_stats.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.

有什么想法吗?

UPDATE:

删除2 ib_logfile的初始工作,但随后又重新出现(可能在重新启动后)。通过再次删除我能够启动mysql的2个文件,但列出了以下错误:

... Many similar errors precede with different page numbers
2018-01-10 13:24:50 10a8 InnoDB: Error: page 329 log sequence number 2371974
InnoDB: is in the future! Current system log sequence number 1601046.
InnoDB: Your database may be corrupt or you may have copied the InnoDB
InnoDB: tablespace but not the InnoDB log files. See
InnoDB: http://dev.mysql.com/doc/refman/5.6/en/forcing-innodb-recovery.html
InnoDB: for more information.
2018-01-10 13:24:50 980 InnoDB: Error: page 0 log sequence number 3484405
InnoDB: is in the future! Current system log sequence number 1601046.
InnoDB: Your database may be corrupt or you may have copied the InnoDB
InnoDB: tablespace but not the InnoDB log files. See
InnoDB: http://dev.mysql.com/doc/refman/5.6/en/forcing-innodb-recovery.html
InnoDB: for more information.
2018-01-10 13:24:50 3032 [Note] InnoDB: 5.6.35 started; log sequence number 1601036
2018-01-10 13:24:50 3032 [Note] Server hostname (bind-address): '*'; port: 3306
2018-01-10 13:24:50 3032 [Note] IPv6 is available.
2018-01-10 13:24:50 3032 [Note]   - '::' resolves to '::';
2018-01-10 13:24:50 3032 [Note] Server socket created on IP: '::'.
2018-01-10 13:24:50 3032 [Warning] InnoDB: Cannot open table mysql/slave_master_info from the internal data dictionary of InnoDB though the .frm file for the table exists. See http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting.html for how you can resolve the problem.
2018-01-10 13:24:50 3032 [Warning] Info table is not ready to be used. Table 'mysql.slave_master_info' cannot be opened.
2018-01-10 13:24:50 3032 [Warning] InnoDB: Cannot open table mysql/slave_worker_info from the internal data dictionary of InnoDB though the .frm file for the table exists. See http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting.html for how you can resolve the problem.
2018-01-10 13:24:50 3032 [Warning] InnoDB: Cannot open table mysql/slave_relay_log_info from the internal data dictionary of InnoDB though the .frm file for the table exists. See http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting.html for how you can resolve the problem.
2018-01-10 13:24:50 3032 [Warning] Info table is not ready to be used. Table 'mysql.slave_relay_log_info' cannot be opened.
2018-01-10 13:24:50 3032 [Note] Event Scheduler: Loaded 0 events
2018-01-10 13:24:50 3032 [Note] mysql\bin\mysqld.exe: ready for connections.
Version: '5.6.35'  socket: ''  port: 3306  MySQL Community Server (GPL)

删除日志文件显然无法解决根本原因。

似乎我不是唯一一个遇到MySql on Ampps问题的人。

2 个答案:

答案 0 :(得分:0)

答案here对我有用:

open the following folder
Ampps/mysql/data/
delete all files like ib_logfile** and mysql-bin.index,mysql-bin.****,
then start or restart MySQL via the AMPPS pannel

对我来说,只有2个ib_logfile。

答案 1 :(得分:0)

我遇到了完全相同的问题,并通过向my.ini添加innodb_force_recovery = 1来修复它。别忘了:

  1. 保存配置并重启MySQL。
  2. 现在停止MySQL,删除刚刚添加的行并再次启动MySQL。
  3. 注意:您也可以简单地将innodb_force_recovery的值更改为0而不是将其删除

    正如你在此指出的link所暗示的,这是非常重要的

    这对我来说是最好的解决方案,不像那些需要你在mysql甚至无法启动O.o时运行sql查询的解决方案