Introduction
Many developers and students use XAMPP to run PHP and MySQL on their computer. But sometimes when you click Start for MySQL, you only see this:
“Attempting to start MySQL service…”
…and nothing happens 😟
Most people think they need to reinstall XAMPP, but that’s risky because you may lose your projects and databases.
👉 Don’t worry! In this guide, I’ll show you a safe and simple way to fix MySQL without reinstalling or losing your data.
Why MySQL Doesn’t Start?
Some common reasons are:
- Another app (like MySQL Workbench, Skype) is using the same port (3306).
- MySQL crashed or PC shut down suddenly.
- Important file
ibdata1
got corrupted. - MySQL data folder has problems.
Step-by-Step Fix
Follow these steps carefully 👇
Step 1: Stop XAMPP Services
- Open XAMPP Control Panel.
- Stop Apache and MySQL.
- Close XAMPP.
- Open Task Manager → if you see
mysqld.exe
, end it.
Step 2: Go to MySQL Folder
- Open this folder:
- Find the data folder.
Step 3: Backup Old Data Folder
- Rename
data
todata_old
. - This is your backup – don’t delete it!
Step 4: Create New Data Folder
-
Make a new folder named
data
. Open:
- Copy everything from
backup
to the newdata
folder. - Important: Don’t copy
ibdata1
.
Step 5: Restore Your Databases
- Open
data_old
. - Copy all folders (your databases) from
data_old
. - Paste them into the new
data
folder. - If Windows asks to replace files → click Skip.
Step 6: Restart MySQL
- Open XAMPP Control Panel.
- Click Start next to MySQL.
- MySQL should now run ✅
Why This Works
- The new data folder has fresh MySQL system files.
- Your old databases are copied back.
- The corrupted ibdata1 is avoided.
Result → MySQL starts again without data loss. 🎉
Tips to Avoid This Problem Again
- Always stop MySQL properly before shutting down PC.
- Take regular database backups.
- Don’t force-close MySQL in Task Manager.
- Check ports if another app is using 3306.
Quick FAQ
Q: Will I lose my databases?
👉 No, if you follow this guide properly, your databases are safe.
Q: Can I delete ibdata1?
👉 No! Never delete it. Just avoid replacing it.
Q: What if this doesn’t work?
👉 Check mysql_error.log
in the data
folder. It shows the exact error.