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
Set vi as the default editor in Ubuntu — a terminal opening the vim editor
How to Set vi (Vim) as the Default Editor in Ubuntu
June 8, 2026
rsync says ALL DONE but files are missing — a terminal showing ALL DONE next to an empty folder
rsync Says “ALL DONE” but Files Are Missing: How to Verify
June 8, 2026
Migrate a website to a new server with rsync — files copying from an old server to a new one over SSH
How to Migrate a Website to a New Server With rsync
June 8, 2026
Bun runtime — faster JS toolkit replacing npm in Laravel projects
How to Install Bun Runtime on Ubuntu (And Use It in a Laravel Project)
May 24, 2026
Tailscale mesh — peer-to-peer connections between devices, coordination server
How to Install Tailscale on Ubuntu (Zero-Config Mesh VPN for Self-Hosters)
May 24, 2026

You Might Also Like

Migrating files from cPanel to aaPanel using rsync
Server Management

cPanel to aaPanel Migration with rsync: Fix Permissions, SSH Port, and CSF Firewall

6 Min Read
Laravel Eloquent exists method checking if a record exists in a database query
Web Development

How to Check if a Record Exists in Laravel

6 Min Read
WordPress wpdb get_results returns multiple rows
Web Development

How to Get Multiple Rows with $wpdb in WordPress

5 Min Read
Laravel DataTables custom column search — filterColumn callback handles the search SQL
Web Development

How to Search Custom or Composite Columns in Laravel DataTables

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?