删除ibdata1后MySQL表消失了

删除ibdata1后MySQL表消失了

本文介绍了删除ibdata1后MySQL表消失了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几天前,经过一番谷歌搜索后,我无法让mysql运行(xampp),我发现了这篇文章:

A couple of days ago I couldn't get mysql to run anymore(xampp) after some googling I found this post: XAMPP - MySQL shutdown unexpectedly

它说要删除我所做的ibdata1文件,mysql再次启动,但是一个数据库的表不见了,但是无论如何我仍然可以看到包含数据文件夹(ibd和frm文件)中值的表我可以恢复那些表了吗?

It said to remove the ibdata1 file which I did, mysql starts again but the tables of one database are gone, however I can still see the tables that contain values in the data folder(ibd and frm files) is there anyway that I can recover those tables?

谢谢.

推荐答案

ibdata1文件很重要,通常除非您要删除所有InnoDB数据并从一个空的MySQL实例开始,否则不应该删除它.

The ibdata1 file is important, and normally you should not delete it unless you want to drop all your InnoDB data and start over with an empty MySQL instance.

即使您使用了innodb_file_per_table=1并且所有表都存储在.ibd文件中,ibdata1文件仍然包含数据字典,这基本上就像InnoDB表空间的全局目录一样.这是InnoDB如何知道您拥有哪些表以及它们驻留在哪些文件中的信息.ibdata1文件还可以在回滚段和更改缓冲区中包含重要数据,这些数据最终将合并到您的表中,但这会花费一些时间.

Even if you used innodb_file_per_table=1 and all your tables are stored in .ibd files, the ibdata1 file still contains the data dictionary, which is basically like a global table of contents for InnoDB tablespaces. It's how InnoDB knows about what tables you have and which files they reside in. The ibdata1 file can also include important data in the rollback segment and change buffer, which will eventually be merged into your tables but that can take time.

如果您除去了ibdata1,并且已经以每表文件格式存储表数据,则有时可以恢复,但这是一个细致的过程.这里有一些参考资料:

If you have removed ibdata1, and you have been storing table data in file-per-table format, it is sometimes possible to recover, but it's a meticulous process. Here are a few references:

  • A recovery trivia or how to recover from a lost ibdata1 file
  • Connecting orphaned .ibd files
  • How to recover an orphaned .ibd file with MySQL 5.6

还原最近的备份然后再使用二进制日志来播放最近一次备份之后所做的更改.

It's simpler to restore your most recent backup and then use the binary log to play back changes made subsequent to your most recent backup.

这篇关于删除ibdata1后MySQL表消失了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 07:14