- Home
- PHP
- [Fix] Error: MySQL shutdown unexpectedly in XAMPP
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 forumsHow 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.
- Rename the folder xampp/mysql/data to xamppmysql/data_bk
- Create a new folder xampp/mysql/data
- Copy the content that resides in xampp/mysql/backup to the new mysql/data folder
- 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 - Finally copy the ibdata1 file from xampp/mysql/data_bk and replace it inside xampp/mysql/data folder
- 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
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
While undergoing this process make sure you backup all your data in a secure place.