如何在XAMPP中还原mysql数据库?

如何在XAMPP中还原mysql数据库?

问题描述:

我有整个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.

您不能复制具有InnoDB表的数据库文件夹,因为 InnoDB存储引擎之间保持着共生关系 InnoDB表的物理文件(frm和.ibd)和数据字典.

You cannot copy a database folder that has InnoDB tables because InnoDB storage engine maintains a symbiotic relationship between the InnoDB tables' physical files (frm and .ibd) and the data dictionary.

参考: https://dba .stackexchange.com/questions/82093/moving-binary-database-folder-is-cause-issues-innodb-tables

您可以尝试(InnoDB部分):

You can try (InnoDB part): https://dba.stackexchange.com/questions/57120/recover-mysql-database-from-data-folder-without-ibdata1-from-ibd-files/57157#57157

建议:根据您的情况,可能要晚了,但是,在移至另一台服务器之前,将数据库导出到sql文件并从phpmyadmin,Mysql Workbech导入它是一个好主意. ,SQLyog或终端

Recommendation: It might be late in your case, however, before you move to another server, it is a good idea to export your databases to a sql file and Import it from phpmyadmin, Mysql Workbech, SQLyog or terminal

导出:

mysqldump -u user -p password database_name > database_name.sql

导入

mysql -u user -p password database_name < database_name.sql