Skip to content

Instantly share code, notes, and snippets.

@MrNegativeTW
Last active April 3, 2024 10:50
Show Gist options
  • Save MrNegativeTW/ed473e402984c7967c0dcfceb4c14ef2 to your computer and use it in GitHub Desktop.
Save MrNegativeTW/ed473e402984c7967c0dcfceb4c14ef2 to your computer and use it in GitHub Desktop.
XAMPP MySQL Crash again? Here is the soluation.

Fix MySQL after reinstall XAMPP

Environment

You are using...

  • Windows
  • XAMPP
  • PHPMyAdmin

Situation

  1. You want to continue your work from yesterday
  2. You opened up MySQL from the XAMPP control panel
  3. It tells you that your SQL has occurred some problem
  4. You Googled, but can't fix
  5. You decided to reinstall XAMPP
  6. You are lazy to recreate those tables and users
  7. You copied folders in C:\xampp\mysql\data, and paste them to the newly installed MySQL folder.
  8. Your database is coming back.
  9. But there are more problem has occurred..., like users db has blow up.

Soluation

Fix The Fucking XAMPP MySQL

  1. Copy all your tables folder and a file called ibdata1 from C:\xampp\mysql\data.
  2. Reinstall xampp
  3. Paste the folders and ibdata1 you just copied to the newly installed MySql folder.

Fix users table

Error Message from phpmyadmin:

Index for table 'db' is corrupt; try to repair it
  1. Open terminal then cd to C:\xampp\mysql\bin, and run the following command to fix it.
.\mysqlcheck.exe -u root -r --database mysql --use-frm

Done

Now you just need to recreate your users, everything else is back.

Don't touch global_priv table inside mysql folder, I once touched, then it blew up again.

If you have any better soluation, plz leave a comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment