Blog de programación, errores, soluciones

Chose Language:
comments
Author: Admin/Publisher |finished | checked

XAMPP – Error: MySQL shutdown unexpectedly

In these last few days, I have encountered this exact error after updating my Windows, before everything was working correctly. Unfortunately, I did not take a screenshot of my error, but the error was very similar to the one presented below. XAMPP – Error: MySQL shutdown unexpectedly

In this section, we will see how to fix some of the MySQL problems in XAMPP.

Case 1: The port is giving problems.

Initially, I thought the port was the problem, but on second thought, the program should have notified that the port was being used.

Anyway, I checked this just in case:

First, to know which port my MySQL (MariaDB) is trying to use, you can do this within XAMPP in Config > Service and Port Settings > MySQL.

Usually, our main port is 3306, which we can change if it is being used as a second solution if this is the case.

If the port is being used, it will return a result, if not, it won’t

(CMD – Terminal)
netstat -ano -p tcp |find "3306"
  TCP    0.0.0.0:3306           0.0.0.0:0              LISTENING       6956

In the previous image, we can see that the PID (process id) is 6956, so we could stop that process in order to use the application that is using our port, if that were the case.

Additionally, we could also change the port that MySQL uses to another port in Config > Service and Port Settings > MySQL.

You could also search for the service in services and stop it if it is using IIS in addition to XAMPP, for example. You can access services from the XAMPP Control Panel.

Case 2: Something has damaged and prevents MySQL from starting

If MySQL is not starting, it is possible that something has damaged the configuration files or the data folder. One possible solution is to try to restore a previous backup of the data folder or reconfigure the MySQL server.

In this case, we could look at the logs and other information to find out what happened.

To solve this issue, you need to go to the MySQL folder. You can do this by clicking on “config” and then “browse”. This will open the file explorer in the MySQL folder.

Here, you need to look at two folders: data and backup. The most important file in the “data” folder is ibdata1. The folder names for your databases are also important.

Note that ibdata1 should not be deleted, as this contains important information about your databases. It’s recommended to make a backup of the data folder (renamed to old-data) before proceeding.

To fix the issue, replace the files in the data folder with the ones from the backup folder, except for ibdata1. After doing this, MySQL should work correctly.

If you don’t remember whether you have a backup of the data folder, don’t worry, as you won’t have lost any data from your databases.

Category: en-others
Something wrong? If you found an error or mistake in the content you can contact me on Twitter | @luisg2249_luis.
Last 4 post in same category

Comments