How do i fix mysql shutdown unexpectedly in xampp?

  1. Home
  2. PHP
  3. [Fix] Error: MySQL shutdown unexpectedly in XAMPP

How do i fix mysql shutdown unexpectedly in xampp?

  • December 4, 2020
  • MySQL, PHP

In some cases or updates XAMPP start doing unexpected things. Shutdown unexpectedly is one of them and it makes us really curious. Because the data we have in our database is important and we cannot risk that at all.

In case you are getting following from the XAMPP control panel then you need to restore your database from backup.

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

How to fix MySQL shutdown unexpectedly

Note: If you don’t do following very carefully there are chances you can lose your databases. So be very careful to follow point 1.

  1. Rename the folder xampp/mysql/data to xamppmysql/data_bk
  2. Create a new folder xampp/mysql/data
  3. Copy the content that resides in xampp/mysql/backup to the new mysql/data folder
  4. Copy all your database folders that are in xamppmysql/data_bk to xampp/mysql/data
    Important: Do not copy the mysql, performance_schema, and phpmyadmin folders from xampp/mysql/data_bk
  5. Finally copy the ibdata1 file from xampp/mysql/data_bk and replace it inside xampp/mysql/data folder
  6. Start MySQL from XAMPP control panel

I hope this time it worked for you! please leave your feedback below to help others.

Users working on the MySQL platform encounter an error called “Error: MySQL shutdown unexpectedly”. Issues in the database and corrupted files are some of the reasons behind this error. So, removing these corrupted files will fix this issue.

You might face this error while starting the XAMPP control panel and the Apache module. In this post, we will find a way to resolve this issue.

Cause of “Error: MySQL Shutdown Unexpectedly” in XAMPP

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.

This is what the error looks like – 

Error: MySQL shutdown unexpectedly.

This may be due to a blocked port, missing dependencies,

improper privileges, a crash, or a shutdown by another method.

Press the Logs button to view error logs and check

the Windows Event Viewer for more clues

If you need more help, copy and post this

entire log window on the forums

How do i fix mysql shutdown unexpectedly in xampp?

Error log

\xampp\mysql\data\mysql_error.log 

InnoDB: Mutexes and rw_locks use Windows interlocked functions

InnoDB: Uses event mutexes

InnoDB: Compressed tables use zlib 1.2.11

InnoDB: Number of pools: 1

InnoDB: Using SSE2 crc32 instructions

InnoDB: Initializing buffer pool, total size = 16M, instances = 1, chunk size = 16M

InnoDB: Completed initialization of buffer pool

InnoDB: 128 out of 128 rollback segments are active.

InnoDB: Creating shared tablespace for temporary tables

InnoDB: Setting file '\xampp\mysql\data\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...

InnoDB: File '\xampp\mysql\data\ibtmp1' size is now 12 MB.

InnoDB: Waiting for purge to start

InnoDB: 10.4.11 started; log sequence number 47134; transaction id 9

InnoDB: Loading buffer pool(s) from E:\xampp\mysql\data\ib_buffer_pool

Plugin 'FEEDBACK' is disabled.

InnoDB: Buffer pool(s) load completed at 201018 18:42:04

Server socket created on IP: '::'.

Steps to fix this problem – 

  • Stop the XAMPP server, MySQL and Apache
  • Create a backup of the “/xampp/mysql/data” folder using a compression software
  • Rename the “/xampp/mysql/data” folder to “/xampp/mysql/data-old”
  • Create a new folder and name it “/xampp/mysql/data”
  • Copy all folders from the “/xampp/mysql/backup”and paste it to the “/xampp/mysql/data”folder, which you have just created
  • Copy all the databases from the “/xampp/mysql/data-old”folder and paste it to the “/xampp/mysql/data” folder
  • Finally copy the “ibdata1” and all of the log files including “ib_logfile0, ib_logfile1 ” from “/xampp/mysql/data-old” and paste it to the “/xampp/mysql/data” folder
  • Start MySQL from the XAMPP control panel
  • Go to phpMyAdmin to check if all the databases are available and running properly

How do i fix mysql shutdown unexpectedly in xampp?

While undergoing this process make sure you backup all your data in a secure place.

Why is MySQL shutdown unexpectedly?

In some cases, the problem appears after users reinstall XAMPP on their computer. The reason this happens is when the MySQL files are corrupted or damaged in which case you will have to use the backup folder that can be found in the mysql directory.

How do I fix MySQL port in XAMPP?

Stop the Apache Server from XAMPP Control Panel (if running).
Now open XAMPP Control Panel => Config (Top Right) => MySQL and change the Main Port to 3307 => Save => Save..
Click Config of MySQL (From Control Panel only) => my.ini and then Change all the occurrences of 3306 to 3307 (Search using ctrl + F and replace all).

How do I fix MySQL has stopped working?

MySQL service on local computer started and then stopped..
Right-click the Data folder..
Select Properties..
Select the Security tab..
Click Advanced..
Click Change Permissions…..
Click Add…..
Enter NETWORK SERVICE ..
Click Check Names..

How do I start MySQL in XAMPP?

Setup mySql and install some textbook databases on your machine.
In phpmyadmin, click the Users tab at the top..
Find the row that has User root and Host 127.0.0.1..
Click Edit Privileges..
Click Change password..
Enter the password twice (write it down somewhere if you're not sure you can remember it).
Click the Go button..