Recovering mysql database from data folder backup
- Copy your all old databases from old to newly installed Xampp under this dir
C:\xampp\mysql\data\
- Copy these below files from new xampp (C:\xampp\mysql\data) and keep back up
ib_logfile0, ib_logfile1 and ibdata1
Similarly copy and replace ib_logfile0, ib_logfile1 and ibdata1 from old xampp to new xampp
If previous Db has crushed or error like mysqld.exe has stopped working use below 2 lines inside my.ini file of mysql
[mysqld]
innodb_force_recovery = 2
innodb_file_per_table=1
- Restart Apache and MYSQL and go to PHPMyadmin to export your previous database.
- finally replace your back up ib_logfile0, ib_logfile1 and ibdata1 that was taken bakup previously
Here's how I dealt with this kind of situation:
- Stop the Apache and MySql services from xampp control panel.
- Back up (just in case), then delete the
data
folder from your new xampp installation folder<physical_drive>/xampp/mysql
.(The
data
folder contains the schema/table definitions (.frm files) for your tables.) - Copy the
data
folder from your previousxampp
folder (or the backup) undermysql
and paste it to the new location (i.e.<physical_drive>/xampp/mysql
). - Now start the Apache and MySql services from the xampp control panel.
There you go, the tables should show up with their structures as you click on them.
Note: Make sure you leave the bin
folder under your xampp installation folder untouched.
It is possible, I found out a solution:
- Install new xampp
- Copy your old database folder from
xampp\mysql\data\databasefolder to Paste in your running xampp folder
C:\xampp\mysql\data - After that stop mysql and apache service then backup your running xampp files ib_logfile0,ib_logfile1 and ibdata1 and store in safe place
- Then Copy same file (ib_logfile0,ib_logfile1 and ibdata1) from old xampp\mysql\data\ and paste in your running xampp server C:\xampp\mysql\data\
- Start mysql and apache service Open CMD Fire command C:\xampp\mysql\bin>mysqldump -u dbusername -p dbpassword dbname>D:\exportdb.sql
- stop mysql and apache service and restore your main ib_logfile0,ib_logfile1 and ibdata1 file (check Step 3)
- after than again start service and open http://localhost/phpmyadmin/ and import database backup from D:\exportdb.sql Now your backup is working :)