How to restore mysql database in XAMPP?

后端 未结 4 1071
太阳男子
太阳男子 2021-01-06 16:13

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

4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-06 16:43

    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
    

提交回复
热议问题