🛠️ How to Safely Reset Your MySQL Data in XAMPP for a Fresh Start
If you’re working locally with XAMPP and need to reset your MySQL environment while keeping backups, follow this step-by-step guide:
✅ Step 1: Go to Your MySQL Data Directory
-
Navigate to your XAMPP installation folder (usually
C:\xampp). -
Open the
mysqlfolder. -
Inside
mysql, locate thedatafolder.
🗂️ Step 2: Backup Existing Data
-
Make a copy of the
datafolder. -
Rename the copy to something like
data_oldfor backup purposes.
❌ Step 3: Delete Specific Folders and Files
⚠️ Be very careful—this step removes your website databases!
-
Open the original
datafolder. -
Delete the following folders:
-
mysql -
performance_schema -
phpmyadmin -
test
-
-
Now, delete all files in the
datafolder except:-
ibdata1→ Do not delete this file.
-
📂 Step 4: Restore from Backup
-
Go back to the main
mysqlfolder. -
Open the
backupfolder. -
Select all contents except
ibdata1. -
Copy and paste them back into the
mysql\datafolder.
🎉 All Done!
You’ve now reset your MySQL environment safely. Open XAMPP and start MySQL—your new setup is ready to go.
