Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XAMPP - MySQL shutdown unexpectedly

Tags:

mysql

xampp

People also ask

Why MySQL is stopping in XAMPP?

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 .

Why does MySQL shut down?

Apart from corrupted files, improper database shut down, missing files and port changes can also cause this error. When you run MySQL in a webserver, the corrupted files in the mysql/data folder cause MySQL to shut down.


STOP! Please do NOT delete ibdata1 file!

Deleting this file is like playing a Russian roulette with your databases, it could work and restablish everything, but also, probably could leave unusable every database you have.

Instead, first try using the MySQL backup folder which is included with XAMPP. So do the next:

  1. Rename the folder mysql/data to mysql/data_old (you can use any name)
  2. Create a new folder mysql/data
  3. Copy the content that resides in mysql/backup to the new mysql/data folder
  4. Copy all your database folders that are in mysql/data_old to mysql/data (skipping the mysql, performance_schema, and phpmyadmin folders from data_old)
  5. Finally copy the ibdata1 file from mysql/data_old and replace it inside mysql/data folder
  6. Start MySQL from XAMPP control panel

And, voilà!


IMPORTANT Deleting this file may render any existing MySQL data unusable. Use with caution

Hey I just did this and it worked:

  1. exit Xampp server
  2. go to your C:\xampp\mysql\data directory
  3. delete the ibdata1 file
  4. restart xampp server

It should work


If the answers mentioned above are not working, you can try deleting all the files in data, except for the folder

Goto: C:\xampp\mysql\data

enter image description here

After that: Goto: C:\xampp\mysql\bin

then open with notepad my.ini , Its look like this.

enter image description here

Then delete or put into comment the port 3306 and change it to 8111 then run xamp with administrator and its work well.


  1. Go to mysql/data/
  2. Delete all random files (except the actual database folders)
  3. Restart Apache and MySQL.

It should fix it.


Just follow two steps

  1. go to xampp\mysql\backup copy everything from backup folder

  2. go to xampp\mysql\data paste everything in data folder copied from backup folder

  3. Thats all.

Also follow the video description to fix without losing any data:

https://www.youtube.com/watch?v=hB1wshpP3Jc


When you're not running XAMPP as an administrator, shutting down MySQL frequently causes corruption which means you have to repair or delete your tables. To avoid this you need to either run XAMPP as an administrator, or use the proper command prompt method for shutting down MySQL.

You can delete ibdata1 as Kratos suggests, but this can leave you with a broken database as other pieces of your database are still in the /mysql/data/ folder. In my case, this residual data stopped me successfully installing WordPress.

A cleaner way of undoing the damage is to revert your whole /mysql/data/ folder. Windows has built-in folder versioning — right click on /mysql/data/ and select Restore previous versions. You can then delete the current contents of the folder and replace it with the older version's contents.

Addendum: To ensure that you don't forget to run XAMPP as an administrator you can right click the XAMPP shortcut, go to Properties, then Advanced, and finally tick Run as administrator.