Sunday, April 2, 2023
BlogHow to solve "Error: MySQL shutdown unexpectedly"?

How to solve “Error: MySQL shutdown unexpectedly”? [100% Working]

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:

  1. Rename folder mysql/data to mysql/data_old
  2. Make a copy of mysql/backup folder and name it as mysql/data
  3. Copy all your database folders from mysql/data_old into mysql/data (except mysql, performance_schema, and phpmyadmin folders)
  4. Copy mysql/data_old/ibdata1 file into mysql/data folder
  5. Start MySQL from XAMPP control panel

And, voilà!

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:

  1. First of all, open up the XAMPP Control Panel.
  2. From the XAMPP Control Panel, open up a shell by clicking the Shell button provided.XAMPP Control Panel
  3. Once the shell is open, enter the following command to start mysql:mysqld –console –skip-grant-tables –skip-external-locking
  4. After that, go ahead and open another shell window from the control panel.
  5. In the new shell window, copy and paste the following command to repair the database:mysqlcheck -r –databases mysql –use-frm
  6. Once you have done that, stop mysql from the first shell window and then close both of the shell windows.
  7. 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:

  1. First of all, open up the Run dialog box by pressing the Windows key + R keys on your keyboard.
  2. In the Run dialog box, type in services.msc and then hit Enter.
  3. Opening Windows Services Window
  4. You will be able to see a list of all the services on your system in the Services window that opens up.
  5. From the list of services, locate the MySQL service and then right-click on it. From the drop-down menu, choose Stop.
  6. Alternatively, you can simply highlight the MySQL service and click the Stop button on the left-hand side.Stopping MySQL Service
  7. 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:

  1. First of all, open up the Windows Explorer and navigate to the xampp installation directory. Opening up XAMPP Folder
  2. Inside the xampp folder, make your way to mysql > bin.
  3. 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.
  4. 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
  5. After that, save the file and open up XAMPP again.
  6. Finally, try starting the MySQL server to see if the error is still there.

Courtesy: Appuals

Check our WordPress themes and plugins

Related Posts

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Featured

We have detected that you are using an ad blocker.

Please support us by disabling your ad blocker or whitelist our site.