How to fix ‘Error: MySQL shutdown unexpectedly.’ in XAMPP

The error “Error: MySQL shutdown unexpectedly.” is encountered by MySQL platform by alot of users. Some of the causes of this error include database issues and corrupted files. As a result, removing these corrupted files will resolve the problem.

You may encounter this error when launching the XAMPP control panel and the Apache module. In this article, we will look for a easy solution to this problem.

What causes ‘Error: MySQL shutdown unexpectedly.’ in XAMPP?

Aside from corrupted files, this error can also be caused by improper database shutdown, missing files, and port changes. MySQL shuts down when corrupted files in the mysql/data folder cause it to run in a webserver. Or an unexpected shutdown of system while XAMPP control panel is running.

The error log will be showing the error something like this

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
error: mysql shutdown unexpectedly.

If the ‘error: mysql shutdown unexpectedly.’ log file looks like this

2013-08-02 12:19:12 4536 [Note] Plugin 'FEDERATED' is disabled.
2013-08-02 12:19:12 f64 InnoDB: Warning: Using innodb_additional_mem_pool_size is DEPRECATED. This option may be removed in future releases, together with the option innodb_use_sys_malloc and with the InnoDB's internal memory allocator.
2013-08-02 12:19:12 4536 [Note] InnoDB: The InnoDB memory heap is disabled
2013-08-02 12:19:12 4536 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2013-08-02 12:19:12 4536 [Note] InnoDB: Compressed tables use zlib 1.2.3
2013-08-02 12:19:12 4536 [Note] InnoDB: Not using CPU crc32 instructions
2013-08-02 12:19:12 4536 [Note] InnoDB: Initializing buffer pool, size = 16.0M
2013-08-02 12:19:12 4536 [Note] InnoDB: Completed initialization of buffer pool
2013-08-02 12:19:12 4536 [Note] InnoDB: Highest supported file format is Barracuda.
2013-08-02 12:19:12 4536 [Note] InnoDB: The log sequence numbers 0 and 0 in ibdata files do not match the log sequence number 1616798 in the ib_logfiles!
2013-08-02 12:19:12 4536 [Note] InnoDB: Database was not shutdown normally!
2013-08-02 12:19:12 4536 [Note] InnoDB: Starting crash recovery.
2013-08-02 12:19:12 4536 [Note] InnoDB: Reading tablespace information from the .ibd files...

How do I fix MySQL error unexpectedly shutdown?

Steps to fix ‘Error: MySQL shutdown unexpectedly.’

Step 1. First, stop the Apache and MySQL from XAMPP server.

Step 2. Create a backup folder of /xampp/mysql/data folder.

Step 3. Now rename /xampp/mysql/data into /xampp/mysql/data-old.

Step 4. Create a new folder with the name of /xampp/mysql/data.

Step 5. Now, copy all of the folders from /xampp/mysql/backup and paste it into /xampp/mysql/data folder, which you have created just now.

Step 6. Copy all of the database from the /xampp/mysql/data-old folder and paste it into /xampp/mysql/data folder

Step 7. Finally, copy ibdata1 and all the log files including ib_logfile0 ib_logfile1 from /xampp/mysql/data-old and paste it to the /xampp/mysql/data folder

Steo 8. Now, restart MySQL server from the XAMPP control panel

error: mysql shutdown unexpectedly.

Boom!!!, Go to http://localhost/phpmyadmin and check all of the database are working correctly or not.

Also make sure to take backup of all data you will be working with this article.

You May Also LikeHow to Create API in PHP with MySQL – Step By Step

Frequently Asked Questions for ‘Error: MySQL shutdown unexpectedly.’

Why is MySQL shutting down in XAMPP?

It majorly happens when one of your database file in “mysql/data” folder is corrupted or when you shutdown XAMPP Control Panel unexpectedly.

How can I change MySQL port 3306 in XAMPP?

Go to XAMPP beside MySQL go to config and open my.ini file search for 3306 and replace the values.

How do I fix MySQL port 3306 already in use?

It happens if any other resources are using that port an easy way to fix this issue is to change the MySQL port from my.ini file, change port from 3306 to your desired value.

How do I uninstall MySQL?

For uninstalling MySQL from windows, make sure you stop the running server first. R=The follow the steps
Step 1. C:\Program Files\MySQL
Step 2. C:\Program Files (x86)\MySQL
Step 3. C:\ProgramData\MySQL
Step 4. C:\Users\<your-username>\AppData\Roaming\MySQL

1 thought on “How to fix ‘Error: MySQL shutdown unexpectedly.’ in XAMPP”

Leave a Comment

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