Fix XAMPP MySQL Not Starting – Easy Guide (No Reinstall, No Data Loss)

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

  1. Open XAMPP Control Panel.
  2. Stop Apache and MySQL.
  3. Close XAMPP.
  4. Open Task Manager → if you see mysqld.exe, end it.


Step 2: Go to MySQL Folder

  • Open this folder:
C:\xampp\mysql
  • Find the data folder.

Step 3: Backup Old Data Folder

  1. Rename data to data_old.
  2. This is your backup – don’t delete it!


Step 4: Create New Data Folder

  • Make a new folder named data.
  • Open:

C:\xampp\mysql\backup

  • Copy everything from backup to the new data folder.
  • Important: Don’t copy ibdata1.


Step 5: Restore Your Databases

  1. Open data_old.
  2. Copy all folders (your databases) from data_old.
  3. Paste them into the new data folder.
  4. If Windows asks to replace files → click Skip.


Step 6: Restart MySQL

  1. Open XAMPP Control Panel.
  2. Click Start next to MySQL.
  3. 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.


Continue working on your projects without fear of losing your data. 🚀

Post a Comment

Previous Post Next Post

Contact Form