如何在XAMPP中还原mysql数据库? [英] How to restore mysql database in XAMPP?

查看:475
本文介绍了如何在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

这篇关于如何在XAMPP中还原mysql数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆