Note: If one of these below does not solve your “MySQL shutdown unexpectedly” problem, please uninstall XAMPP completely and remove the XAMPP file from Local Disk(C). Then reinstall it. It will definitely solve your problem.
Fix “MySQL shutdown unexpectedly”
Use MySQL Backup Folder
first, try using the MySQL backup folder which is included with XAMPP. So do the next steps:
- Rename folder
- Make a copy of
mysql/backupfolder and name it as
- Copy all your database folders from
- Start MySQL from XAMPP control panel
Repair MySQL Database with Shell
In addition to the above method, you can also try to resolve the problem by trying to repair the MySQL server using the Shell located inside the XAMPP Control Panel. If you are looking for more of a command-line approach, this is the solution for you. Here, we will first try to open up the MySQL server using the shell and then try to repair the MySQL database in a different shell window. To do this, follow the instructions given down below:
- First of all, open up the XAMPP Control Panel.
- From the XAMPP Control Panel, open up a shell by clicking the Shell button provided.XAMPP Control Panel
- Once the shell is open, enter the following command to start mysql:mysqld –console –skip-grant-tables –skip-external-locking
- After that, go ahead and open another shell window from the control panel.
- In the new shell window, copy and paste the following command to repair the database:mysqlcheck -r –databases mysql –use-frm
- Once you have done that, stop mysql from the first shell window and then close both of the shell windows.
- After that, go ahead and restart mysql to see if the problem is still there.
Stop MySQL Service
As it turns out, the problem can also be caused by the MySQL service in some cases. This happens when the MySQL service is running before you try to start the mysql server via the XAMPP Control Panel. In such a case, you will have to simply stop the MySQL service from the Windows Services window. The services running on your system can sometimes cause different issues when they are malfunctioning like failing to connect to a Windows service and more so it’s nothing really to worry about. With that said, follow the instructions down below to stop the service:
- First of all, open up the Run dialog box by pressing the Windows key + R keys on your keyboard.
- In the Run dialog box, type in services.msc and then hit Enter.
- Opening Windows Services Window
- You will be able to see a list of all the services on your system in the Services window that opens up.
- From the list of services, locate the MySQL service and then right-click on it. From the drop-down menu, choose Stop.
- Alternatively, you can simply highlight the MySQL service and click the Stop button on the left-hand side.Stopping MySQL Service
- Wait for the service to stop. After that, try starting the MySQL server manually from the XAMPP Control Panel to see if the problem still occurs.
Change Client and Server Ports
In some scenarios, the problem can also be caused by the ports that are being used by the MySQL server. This can happen when the ports that MySQL server is trying to use are already being used by another service or when the said ports are blocked on your system. To resolve the problem, you will have to change the client and server ports from the my.ini file. To do this, follow the instructions given down below:
- First of all, open up the Windows Explorer and navigate to the xampp installation directory. Opening up XAMPP Folder
- Inside the xampp folder, make your way to mysql > bin.
- Then, in the bin folder, open up the my.ini file in a notepad. This can be done by right-clicking on the file and choosing Open with > Notepad.
- Once the my.ini file is open, look for the client and server port as shown in the picture down below and change them. Editing Client and Server Port
- After that, save the file and open up XAMPP again.
- Finally, try starting the MySQL server to see if the error is still there.