如何从物理文件恢复 MySQL 数据库

2022-01-14 00:00:00 xampp mysql restore

不幸的是,我在我的 windows 机器上卸载了 Xampp,/xamp/mysql/data 文件夹中有大约 50 个数据库.我没有备份脚本,但我有 Xamp/mysql/data 文件夹的副本.如何使用该数据目录恢复 MySQL 数据库.

Unfortunately I uninstalled Xampp in my windows machine, there are about 50 databases in /xamp/mysql/data folder. I have not taken backup script, but I have a copy of Xamp/mysql/data folder.How can I restore MySQL Databases using that Data Directory.

提前致谢

推荐答案

我正在寻找解决方案

  1. 安装新的 xampp
  2. 从xamppmysqldatadatabasefolder 粘贴到您正在运行的 xampp 文件夹中
    C:xamppmysqldata
  3. 然后停止 mysql 和 apache 服务,然后备份您正在运行的 xampp 文件 ib_logfile0、ib_logfile1 和 ibdata1 并存储在安全的地方
  4. 然后从旧文件复制相同的文件(ib_logfile0、ib_logfile1 和 ibdata1)xamppmysqldata 并粘贴到您正在运行的 xampp 服务器 C:xamppmysqldata
  5. 启动mysql和apache服务Open CMD Fire命令C:xamppmysqlin>mysqldump -u dbusername -p dbpassword dbname>D:exportdb.sql
  6. 停止 mysql 和 apache 服务并恢复您的主 ib_logfile0、ib_logfile1 和 ibdata1 文件(检查第 3 步)
  7. 再次启动服务并打开 http://localhost/phpmyadmin/ 并从 D: 导入数据库备份导出数据库.sql现在您的备份正在运行 :)
  1. Install new xampp
  2. Copy your old database folder from xamppmysqldatadatabasefolder to Paste in your running xampp folder
    C:xamppmysqldata
  3. After that stop mysql and apache service then backup your running xampp files ib_logfile0,ib_logfile1 and ibdata1 and store in safe place
  4. Then Copy same file (ib_logfile0,ib_logfile1 and ibdata1) from old xamppmysqldata and paste in your running xampp server C:xamppmysqldata
  5. Start mysql and apache service Open CMD Fire command C:xamppmysqlin>mysqldump -u dbusername -p dbpassword dbname>D:exportdb.sql
  6. stop mysql and apache service and restore your main ib_logfile0,ib_logfile1 and ibdata1 file (check Step 3)
  7. after than again start service and open http://localhost/phpmyadmin/ and import database backup from D:exportdb.sql Now your backup is working :)

相关文章