Fixing ‘MySQL Shutdown Unexpectedly’ Error: Quick and Easy Solution.

Some time ago, while using XAMPP, the MySQL service failed to start. Without any apparent cause, I lost access to my databases. Although it didn’t pose a threat to the development of my projects, this error cost me a lot of time the first time it happened.

After trying many things, I solved the problem by backing up my projects and reinstalling XAMPP with the latest version. The issue disappeared for a few days, but then it happened again. This time, reinstalling everything was not an option.

The solution

We must go to our XAMPP installation, depending on the installation path. In my case, C:\xamp\mysql

  • Rename folder mysql/data to mysql/data_old
  • Make a copy of mysql/backup folder and name it as mysql/data
  • Copy all your database folders from mysql/data_old into mysql/data (except mysqlperformance_schema, test, and phpmyadmin folders)
  • Copy the ibdata1 file in mysql/data_old/ folder, to mysql/data folder
  • Start MySQL from XAMPP control panel

Done! The MySQL service is running again, and we haven’t lost our databases or data.

Leave a Reply

Your email address will not be published. Required fields are marked *