错误:无法打开单表表空间文件。\ scrapers \ records.ibd

时间:2016-02-03 18:01:58

标签: mysql database recovery

我在Windows 10上安装了AMPPS。

我无法启动MySQL。我搜索了这个错误并尝试了不同的方法来恢复我的数据。

这是错误日志:

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

我尝试在my.cnf中设置innodb_force_recovery = 1

此外,我也尝试删除ibdata1文件。

删除ibdata1后,MySQL启动完美。

我的表在PHPmyADMIN中显示,但当我点击它时它显示table does not exists even it exists

在我的D:\Ampps\mysql\data\scrapers目录中,我也可以看到records.ibd文件和records.frm文件。这意味着表存在但存在损坏。

有人知道如何恢复该表吗?

1 个答案:

答案 0 :(得分:6)

设定值

innodb_force_recovery = 1 

或2或3或4 在[mysql]

下的my.ini文件中

尝试这有希望它会解决你的问题。