如何在 XAMPP 中恢复 mysql 数据库?

2022-01-14 00:00:00 backup xampp mysql innodb

我有整个 xampp/mysql 文件夹的备份.如何在全新安装的 XAMPP 上使用它来恢复我的旧数据库?

I have a backup of the entire xampp/mysql folder. How can I use it to recover my old db on a fresh installation of XAMPP?

简单地将旧的 xampp/mysql 文件夹复制到新的 xampp 会导致以下 mysql 错误:

Simply copying the old xampp/mysql folder to new xampp leads to mysql errors like:

InnoDB:InnoDB 数据中的表 veno/sls37_finder_links_termsc字典的表空间 id 为 1171,但具有该 id 或名称的表空间不存在.您是否删除或移动了 .ibd 文件?这也可能是使用 CREATE TEMPORARY TABLE 创建的表,其 .ibd 和 .frm 文件MySQL 自动删除,但 InnoDB 中该表仍然存在内部数据字典.

InnoDB: Table veno/sls37_finder_links_termsc in the InnoDB data dictionary has tablespace id 1171, but tablespace with that id or name does not exist. Have you deleted or moved .ibd files? This may also be a table created with CREATE TEMPORARY TABLE whose .ibd and .frm files MySQL automatically removed, but the table still exists in the InnoDB internal data dictionary.

推荐答案

要将数据库恢复到 XAMPP,您需要以下这些东西:-.frm 、 .ibd 文件和 ibdata1 可以在 mysql/data 文件夹中找到

To restore your database to XAMPP these are the things you need: -.frm , .ibd files , and ibdata1 can be found in mysql/data folder

步骤

  • 安装新的 XAMPP

  • Install New XAMPP

替换mysql/data中的ibdata1

Replace ibdata1 in mysql/data

复制要恢复的数据库的文件夹 [.frm 和 .ibd]并粘贴到 mysql/data 中

Copy the folders of the database you want to restore [.frm and .ibd] and paste in mysql/data

运行 mysql 和 Viola 就可以了!

Run the mysql and Viola it works!

如果出现#1932错误,只需导入create_tables.sql来自 xampp/phpMyAdmin/sql,这就解决了问题.

If there is an #1932 error occur, just import the create_tables.sql from xampp/phpMyAdmin/sql and this solves the problem.

相关文章