Xampp Error: MySQL shutdown unexpectedly

By Super Admin | Jan 10, 2021 | PHP
Share : Whatsapp


How to solve Xampp error mysql shutdown unexpectedly, this may be due to blocked port, missing dependencies.

When I open XAMPP and click start MySQL button and it gives me an error. I had started it just before, but now it isn't working.

12:19:12 PM [mysql] Attempting to start MySQL app...
12:19:12 PM [mysql] Status change detected: running
12:19:13 PM [mysql] Status change detected: stopped
12:19:13 PM [mysql] Error: MySQL shutdown unexpectedly.
12:19:13 PM [mysql] This may be due to a blocked port, missing dependencies,
12:19:13 PM [mysql] improper privileges, a crash, or a shutdown by another method
12:19:13 PM [mysql] Press the Logs button to view error logs and check
12:19:13 PM [mysql] the Windows Event Viewer for more clues
12:19:13 PM [mysql] If you need more help, copy and post this
12:19:13 PM [mysql] entire log window on the forums

There are 2 types of errors, which display MySQL shutdown unexpectedly, this may be due to blocked port, missing dependencies, because

1. There might be some other Apps like SKYPE etc, which you might have installed. Those apps also will use the PORT of MySql (3306). so either you change the port or uninstall the app.


2. In most of the cases, this error occurs because ibdata1 file gets corrupted. To solve this issue / error follow the below given steps:

You need to follow the below steps
  1. Stop and exit your Xampp
  2. Go to the path: C:\xampp\mysql
  3. You will find a folder named as data. Rename that folder as data-old.
  4. Create a folder with the name data in the same path.
  5. Open the backup folder in the following path:  C:\xampp\mysql\ backup, Copy all the files from it.
  6. Paste it in the data folder in the following path: C:\xampp\mysql\ data.

Now, run your xampp and start the MySQL and check the database in the web browser http://localhost/phpmyadmin/ .

You will be able to see the fresh phpMyAdmin database.

Now, Stop the Apache and MySQL and quit XAMPP. and make the following changes:

Get your old database follow the steps given below:
  1. Open your data-old folder which we had renamed in the beginning 3rd step.
  2. Copy all the folders which is named as your old database name, except the database folders which is already visible in the web browser http://localhost/phpmyadmin/(skipping the mysql, performance_schema, and phpmyadmin folders from data_old).
  3. Paste the copied database folders in the new data folder in following path: C:\xampp\mysql\ data.
  4. Now copy the ibdata1 file from the data-old folder and paste it in the new data folder. If already that file exists then just remove it and paste the one from the data-old folder.   

Now, run your xampp and start the MySQL and check the database in the web browser http://localhost/phpmyadmin/. You will now be able see all your database.

Thanks for reading.