How to restore mysql database in XAMPP?

本秂侑毒 提交于 2019-12-19 04:02:31

问题


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?

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

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.


回答1:


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.

Reference: https://dba.stackexchange.com/questions/82093/moving-binary-database-folder-is-causing-issues-with-innodb-tables

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

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

Export:

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

Import

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



回答2:


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

Steps

  • Install New XAMPP

  • Replace ibdata1 in mysql/data

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

  • Run the mysql and Viola it works!

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




回答3:


Continue to andread answer also copy and replace these files to the new xampp folder.

From \xampp\mysql\data\mysql

Files : proc.frm, proc.MAD, proc.MAI



来源:https://stackoverflow.com/questions/29258769/how-to-restore-mysql-database-in-xampp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!