Generally, when we start MySQL service from XAMPP's control panel, it utilizes default port number 3306. But sometimes it may happen that, some process already uses the MY SQL default port. In such case, the MySQL service fails to start, and XAMPP throws an error stating, that MySQL has shut down unexpectedly. We can either close the process that is using MySQL's port or we can change the default port for MySQL.
Sometimes, this error may arise if for some reason the MySQL data files get corrupted. We can fix this issue by replacing the corrupted data files, in the path mysql/data, with proper files.
This video covers a step-by-step guide to solving this issue. We have covered how to look for a process using MySQL's port number and end that process. We have also covered how to assign a new port number to the MySQL service and also how to replace MySQL's corrupted data files with valid files.
The process is simple. I hope this video helps you to resolve the MySQL service error during its startup.
Thank You.
The written guide to the process of replacing MySQL's data files with valid files is given below (this is the 3rd method explained in the video):
Step 1: Navigate to your XAMPP MySQL directory (C:\xampp\mysql).
Step 2: Create a new folder called DIR_BACKUP.
Step 3: Copy the folders, C:\xampp\mysql\backup and C:\xampp\mysql\data into C:\xampp\mysql\DIR_BACKUP.
Step 4: Copy the contents of C:\xampp\mysql\backup and paste them into C:\xampp\mysql\data and overwrite all the files.
Step 5: Finally copy the ibdata1 file from C:\xampp\mysql\DIR_BACKUP\data and paste it into C:\xampp\mysql\data and overwrite the file.
26 авг 2024