🛠️ 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
mysql
folder. -
Inside
mysql
, locate thedata
folder.
🗂️ Step 2: Backup Existing Data
-
Make a copy of the
data
folder. -
Rename the copy to something like
data_old
for backup purposes.
❌ Step 3: Delete Specific Folders and Files
⚠️ Be very careful—this step removes your website databases!
-
Open the original
data
folder. -
Delete the following folders:
-
mysql
-
performance_schema
-
phpmyadmin
-
test
-
-
Now, delete all files in the
data
folder except:-
ibdata1
→ Do not delete this file.
-
📂 Step 4: Restore from Backup
-
Go back to the main
mysql
folder. -
Open the
backup
folder. -
Select all contents except
ibdata1
. -
Copy and paste them back into the
mysql\data
folder.
🎉 All Done!
You’ve now reset your MySQL environment safely. Open XAMPP and start MySQL—your new setup is ready to go.