🛠 How to Restore MySQL Database from Backup in XAMPP
If you're trying to restore your MySQL databases from a backup using XAMPP, follow these steps carefully:
📁 Step 1: Rename the Existing data Folder
First, you’ll want to rename the current MySQL data directory to keep a backup of it:
Or manually:
-
Navigate to
C:\xampp\mysql. -
Rename the
datafolder todata_old.
📂 Step 2: Copy the Backup Folder
Now, copy your backup folder and rename it to data:
Manually:
-
Copy the entire
backupfolder located inC:\xampp\mysql. -
Paste it inside the same
mysqldirectory. -
Rename the copied folder to
data.
📄 Step 3: Copy Database Folders and MySQL System Folder
Next, copy your actual databases and the mysql system folder from the old data directory to the new one:
-
Go to
C:\xampp\mysql\data_old. -
Copy all your custom database folders (except
performance_schema,phpmyadmin, etc.). -
Also copy the
mysqlfolder. -
Paste them into
C:\xampp\mysql\data.
⚠️ Make sure you're not overwriting any important system folders already present in the
backup.
📌 Step 4: Copy ibdata1 File
Copy the important ibdata1 file from the old data directory:
Manually:
-
Find the
ibdata1file insideC:\xampp\mysql\data_old. -
Copy it and paste it into
C:\xampp\mysql\data, replacing the existing one.
▶ Step 5: Start MySQL from XAMPP
Now, open your XAMPP Control Panel and:
-
Click Start next to MySQL.
-
If everything was copied correctly, MySQL should start without errors.
✅ Final Note
This method is useful when you’re restoring data from a backup or migrating MySQL databases manually. Always back up your folders before making changes!
Replace your MySQL folder into new MySQL file, then its work fine
Comments
Post a Comment