MySQL InnoDB 数据库恢复

发布于 2024-07-05 10:38:06 字数 134 浏览 6 评论 0 原文

我必须恢复在 MySQL 5.0 中无意中删除的数据库。 通过检查备份文件,我似乎只有 .FRM 文件来保存数据库数据。

任何人都可以建议这是否是我从备份执行数据库恢复/导入所需的全部内容,或者我还需要提供其他文件来完成此操作吗?

I have to restore a database that has been inadvertently DROPped in MySQL 5.0. From checking the backup files, I only seem to have .FRM files to hold the database data.

Can anyone advise whether this is all I need to perform a database restore/import from the backup, or are there other files I should have to hand to complete this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

半﹌身腐败 2024-07-12 10:38:06

.frm 文件不是数据文件,它们只是存储“数据字典信息”(参见 MySQL 手册)。 InnoDB 将其数据存储在 ib_logfile* 文件中。 这就是您进行备份/恢复所需要的。 有关更多详细信息,请参阅此处

.frm files are not the data files, they just store the "data dictionary information" (see MySQL manual). InnoDB stores its data in ib_logfile* files. That's what you need in order to do a backup/restore. For more details see here.

放血 2024-07-12 10:38:06

您可以在这里找到详细的解决方案:

http://www.unilogica.com/mysql-innodb- recovery/(葡萄牙文文章)

除了innodb_force_recovery标志之外,我找到了另一个解决方案:innodb_file_per_table,它像MyISAM表一样拆分每个文件中的InnoDB表。

在崩溃恢复中,与单个文件 ibdata1 相比,您丢失的数据要少。

The detailed solution you can found here:

http://www.unilogica.com/mysql-innodb-recovery/ (Article in Portuguese)

Besides the flag of innodb_force_recovery, I found another solution: innodb_file_per_table, that splits InnoDB tables in each file like MyISAM tables.

In a crash recovery you can lost less data than in single file ibdata1.

屌丝范 2024-07-12 10:38:06

恢复innodb:
(假设您的数据文件夹为C:\ProgramData\MySQL\MySQL Server 5.5\data)

  1. 将要恢复的数据库(以数据库名称命名)的文件夹复制到C:\ProgramData\MySQL\MySQL Server 5.5\data
  2. < p>将 3 个 ibdata 文件复制到数据文件夹 ex。 (C:\ProgramData\MySQL\MySQL Server 5.5\data)

    <块引用>
    <前><代码>_ib_logfile0
    _ib_日志文件1
    _ibdata1

  3. 通过文件右键单击 -> 获取 _ib_logfile0 的大小(以 MB 为单位)(它应该与 _ib_logfile1 相同) 属性

  4. 编辑 mysql 配置文件 (mysql\bin\my.ini),使 innodb_log_file_size=343M 与 ibdata 文件大小完全相同

  5. 运行

    <块引用>

    mysqld --defaults-file=mysql\bin\my.ini --standalone --console
    --innodb_force_recovery=6

    运行

  6. 现在您的数据应该回到数据库中。 使用 phpmysql 或任何其他工具导出它们

Restoring innodb:
(assuming your data folder is C:\ProgramData\MySQL\MySQL Server 5.5\data)

  1. Copy the folders of the databases (named after the database name) you want to restore to C:\ProgramData\MySQL\MySQL Server 5.5\data
  2. Copy the 3 ibdata files to the data folder ex. (C:\ProgramData\MySQL\MySQL Server 5.5\data)

    _ib_logfile0
    _ib_logfile1
    _ibdata1
    
  3. Get the size of the _ib_logfile0 in MB (it should be the same as _ib_logfile1) by File Right click -> Properties

  4. Edit the mysql config file (mysql\bin\my.ini) for the innodb_log_file_size=343M to be exactly the ibdata files size

  5. Run

    mysqld --defaults-file=mysql\bin\my.ini --standalone --console
    --innodb_force_recovery=6

  6. Now your data should be back in your database. Export them using phpmysql or any other tool

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文