How7o
  • Home
  • Tools
  • Prank Screens
  • Learn
  • Blog
  • Contact
Reading: How to Fix “Error: MySQL Shutdown Unexpectedly” in XAMPP
Share
How7oHow7o
Font ResizerAa
  • OS
Search
  • Home
  • Tools
  • Prank Screens
  • Learn
  • Blog
  • Contact
Follow US
© 2024–2026 How7o. All rights reserved.
How7o > Free Laravel, PHP, WordPress & Server Tutorials > Server Management > How to Fix “Error: MySQL Shutdown Unexpectedly” in XAMPP
Server Management

How to Fix “Error: MySQL Shutdown Unexpectedly” in XAMPP

how7o
By how7o
Last updated: May 22, 2026
5 Min Read
Fix XAMPP MySQL shutdown unexpectedly error
SHARE

To fix the “Error: MySQL shutdown unexpectedly” message in XAMPP, recover the data directory using the known-good system schema in mysql/backup. Rename the broken mysql/data, copy backup over as the new data, then put your application databases (plus ibdata1) back from the old folder. MySQL starts again with a clean system catalog and your real data intact.

Contents
  • Before you touch anything — back up
  • The XAMPP recovery recipe
  • Why the file dance works
  • If it still won’t start
  • Frequently asked questions
  • Related guides
  • References

Last verified: 2026-05-17 on XAMPP 8.2 (MariaDB 10.4) on Windows 11. Originally published 2023-03-14, rewritten and updated 2026-05-17.

Before you touch anything — back up

Copy C:\xampp\mysql (the whole folder) somewhere safe. The recovery below is non-destructive (it renames rather than deletes), but the cost of a backup is small and the cost of losing your dev databases isn’t.

The XAMPP recovery recipe

  1. Stop MySQL in the XAMPP Control Panel (if it’s even partially running).
  2. Open the XAMPP install directory:
C:\xampp\mysql
  1. Rename mysql\data to mysql\data_old.
  2. Make a copy of mysql\backup and name the copy mysql\data.
  3. Copy every database folder from mysql\data_old into the new mysql\data — except for mysql, performance_schema, and phpmyadmin. Those three live inside the fresh copy already.
  4. Copy mysql\data_old\ibdata1 into mysql\data\, replacing the one that came from backup.
  5. Start MySQL from the XAMPP Control Panel.
  6. Open phpMyAdmin and confirm every database is listed and openable.
XAMPP MySQL recovery — rename data, copy backup, restore databases and ibdata1

Why the file dance works

  • mysql/backup is a clean copy of the system schema that XAMPP ships with — fresh mysql (privileges), performance_schema, and phpmyadmin folders. Using it gives MySQL a working system catalog to boot against.
  • ibdata1 is the shared InnoDB tablespace — table dictionary, undo logs, sometimes data. Restoring yours instead of the empty one in backup is what lets your InnoDB tables come back online.
  • Excluding the three system folders from the per-database copy keeps the new fresh system schema in place instead of overwriting it with the (possibly-broken) old one.

If it still won’t start

  • Check port 3306 is free. Run netstat -ano | findstr :3306 in cmd. Another MySQL service or Skype/IIS/Docker may be holding it.
  • Read mysql\data\<hostname>.err — the very last lines tell you what blew up. “Plugin ‘InnoDB’ init function returned error” usually means ibdata1 still doesn’t match the table files.
  • Last resort: nuke and re-import. Export every database from data_old using a portable MySQL command-line client, reset XAMPP’s mysql\data back to backup, and import the SQL dumps back in.

This recovery is a get back online fast procedure, not a long-term fix. Once MySQL is starting again, dump your databases to .sql files and consider re-installing XAMPP cleanly — the underlying file damage may resurface.

Frequently asked questions

Why does this happen — was XAMPP corrupted?

The most common trigger is a hard shutdown while MySQL was writing (power loss, force-quit, blue screen). InnoDB’s ibdata1 ends up out of sync with the on-disk table files, and MySQL refuses to start to avoid further damage. Less common causes: another service on port 3306 (another MySQL install, Skype, Docker mapping), Windows file permissions after a Windows update, or antivirus locking files in mysql/data/.

Is it safe to overwrite mysql/data with mysql/backup?

Only if you’ve renamed the existing mysql/data to something else first (the recipe renames it to data_old). That keeps your real databases intact — the recovery just restores a clean system catalog and then copies your databases back on top. Never delete data_old until you’ve confirmed every database is accessible after the recovery.

Why exclude the mysql, performance_schema, and phpmyadmin folders when copying?

Those are MySQL’s system schemas — the user table, privileges, internal metadata. They’re tightly bound to the MySQL build, and copying old versions back can re-introduce the same corruption you’re trying to recover from. Use the fresh ones from mysql/backup and only restore your own application databases.

Does this recipe work on a real MySQL install (not XAMPP)?

No — the mysql/backup folder is XAMPP-specific (XAMPP ships it as a known-good copy of the system schema). On a standalone MySQL/MariaDB install, recovery looks different: read the error log first (err.log in the data dir), try innodb_force_recovery=1 through 6 in my.cnf, and dump tables out while in recovery mode.

Related guides

  • How to Automatically Start Apache and MySQL with XAMPP on Windows
  • How to Access MySQL from the Command Line in XAMPP on Windows
  • How to Troubleshoot MariaDB Not Starting

References

XAMPP project page: apachefriends.org. MySQL InnoDB recovery: dev.mysql.com/doc/refman/8.0/en/forcing-innodb-recovery.html.

TAGGED:configurationmysqlwindowsxampp

Sign Up For Daily Newsletter

Be keep up! Get the latest breaking news delivered straight to your inbox.
[mc4wp_form]
By signing up, you agree to our Terms of Use and acknowledge the data practices in our Privacy Policy. You may unsubscribe at any time.
Share This Article
Facebook Copy Link Print
Previous Article Fix CORS policy blocked origin errors in PHP and Apache How to Fix “CORS Policy Blocked Origin” Errors
Next Article Diagnose MySQL 100% CPU usage with PROCESSLIST and INNODB STATUS How to Find What’s Pinning MySQL at 100% CPU
Leave a Comment

Leave a Reply Cancel reply

You must be logged in to post a comment.

FacebookLike
XFollow
PinterestPin
InstagramFollow
Most Popular
Run Laravel queue workers with Supervisor
How to Run Laravel Queue Workers in Production with Supervisor
May 23, 2026
Nginx as a reverse proxy for a Node.js app on Ubuntu
How to Set Up Nginx as a Reverse Proxy for Node.js on Ubuntu
May 23, 2026
Install and configure Redis on Ubuntu for Laravel and WordPress
How to Install and Configure Redis on Ubuntu (for Laravel & WordPress)
May 23, 2026
Harden a fresh Ubuntu VPS with UFW, Fail2Ban, and SSH key auth
How to Harden a Fresh Ubuntu VPS: UFW + Fail2Ban + SSH Key Auth
May 23, 2026
Set up Let's Encrypt SSL with Certbot on Ubuntu
How to Set Up Let’s Encrypt SSL with Certbot on Ubuntu (Apache & Nginx)
May 23, 2026

You Might Also Like

Laravel global variable for views — View::share in AppServiceProvider and View::composer wildcard patterns
Web Development

How to Set a Global Variable for Laravel Views

7 Min Read
Install Laravel on Ubuntu — terminal with composer create-project command and Laravel red-pillar icon
Web Development

How to Install Laravel on Ubuntu: Step-by-Step Guide

9 Min Read
MySQL combine columns into string — CONCAT and CONCAT_WS
Web Development

How to Combine Multiple Columns into One String in MySQL

6 Min Read
MySQL 8 create user and grant privileges on Ubuntu
Web Development

How to Create Users and Grant Privileges in MySQL 8 on Ubuntu

8 Min Read
How7o

We provide tips, tricks, and advice for improving websites and doing better search.

Tools

  • Age Calculator
  • Word Counter
  • Image Upscaler
  • Password Generator
  • QR Code Generator
  • See all tools→

Pranks

  • Fake Blue Screen Prank
  • Hacker Typer
  • Fake iMessage Generator
  • Windows XP Crash Prank
  • Windows 11 Update Prank
  • See all prank screens →

Company

  • About Us
  • Blog
  • Contact
  • Privacy Policy
  • Terms of Service
  • Sitemap
© 2024–2026 How7o. All rights reserved.
Welcome Back!

Sign in to your account

Username or Email Address
Password

Lost your password?