Categories: Development

How to fix MySQL not starting in XAMPP

How to fix MySQL server not starting in the XAMPP control panel. The logs will most likely say unexpected shutdown or “Index for table ‘.\mysql\user’ is corrupt; try to repair it”.

This has happened to me on a few occasions with XAMPP, seemingly caused by stopping the MySQL server in the control panel.

This was my error log upon trying to start the MySQL server:

3:43:26 PM  [mysql]  Attempting to start MySQL app...
3:43:26 PM  [mysql]  Status change detected: running
3:43:28 PM  [mysql]  Status change detected: stopped
3:43:28 PM  [mysql]  Error: MySQL shutdown unexpectedly.
3:43:28 PM  [mysql]  This may be due to a blocked port, missing dependencies, 
3:43:28 PM  [mysql]  improper privileges, a crash, or a shutdown by another method.
3:43:28 PM  [mysql]  Press the Logs button to view error logs and check
3:43:28 PM  [mysql]  the Windows Event Viewer for more clues
3:43:28 PM  [mysql]  If you need more help, copy and post this
3:43:28 PM  [mysql]  entire log window on the forums

The fix

Fixing the MySQL server not starting in XAMPP is done by reverting back the data files pre-issue.

Navigate to your XAMPP MySQL directory (C:\xampp\mysql).

Create a new folder called FIX_BACKUP.

Copy C:\xampp\mysql\backup and C:\xampp\mysql\data into C:\xampp\mysql\FIX_BACKUP.

Paste the contents of C:\xampp\mysql\backup into C:\xampp\mysql\data overwriting all the files.

Finally copy the ibdata1 file from C:\xampp\mysql\FIX_BACKUP\data into C:\xampp\mysql\data overwriting the file.

Your MySQL server should now start in the XAMPP control panel.

Share

Recent Posts

Kennington reservoir drained drone images

A drained and empty Kennington reservoir images from a drone in early July 2024. The…

2 years ago

Merrimu Reservoir drone images

Merrimu Reservoir from drone. Click images to view larger.

2 years ago

Early September spring shots

Some early September spring shots from a bushwalk, It is still too early for wildflowers.

3 years ago

Cloning an NVMe to SK Hynix Platinum P41 NVMe

I recently needed to clone over a smaller NVMe to a 2TB SK Hynix Platinum…

3 years ago

Using Laravel’s deleteDirectory to delete folders and their contents

If you ever needed a simple solution in Laravel to delete an entire directory and…

3 years ago

How to allow only 1 user to register in a Laravel application

How to enforce only one user to register or be registered in a Laravel web…

3 years ago