It is common for XAMPP’s MySQL to suddenly stop starting, causing site and development environment outages. This is mainly due to MySQL data becoming corrupted from forced shutdowns of XAMPP.
This article introduces successful recovery methods without reinstalling XAMPP itself, along with specific examples. Additionally, it explains how to check error logs when problems occur.
Why does MySQL fail to start?
XAMPP’s MySQL is prone to data corruption caused by sudden forced shutdowns or system shutdowns. Especially,
- corruption of the
ibdata1
file - inconsistencies related to
aria_log
files
are common causes.
How to check MySQL error logs
When MySQL fails to start, the first step is to check the error logs to investigate the cause.
Location of error logs
Normally, XAMPP’s MySQL error logs are found at the following locations:
C:\xampp\mysql\data\mysql_error.log
or
C:\xampp\mysql\data\<computer name>.err
(File names may vary depending on XAMPP version or settings.)
Steps to check error logs
- Open the
C:\xampp\mysql\data
folder in Explorer - Open the
mysql_error.log
or files with.err
extension using a text editor (such as Notepad or VSCode) - The end part of the log (latest entries) contains error details. You can find hints about startup failure reasons or file corruption.
- Sending the code to ChatGPT or Gemini to get detailed explanations of the errors can be helpful.
Recovery Method Case 01: Data backup and restore from backup
- Backup the entire MySQL data folder
Copy all files and folders insideC:\xampp\mysql\data
to another safe location. - Delete database folders you created, such as WordPress databases
Delete all database folders you created insideC:\xampp\mysql\data
(for example, WordPress database folders). - Overwrite with backup data
Copy all files fromC:\xampp\mysql\backup
toC:\xampp\mysql\data
and overwrite existing files. - Restore the backed-up database folders
Return the database folders you backed up in step 1 toC:\xampp\mysql\data
(mainly those deleted in step 2). - Very important: Restore the backed-up
ibdata1
file
Overwrite theibdata1
file backed up in step 1 toC:\xampp\mysql\data
.
Recovery Method Case 02: Restart by deleting aria_log files
Deleting the following files in the MySQL data folder of XAMPP may allow MySQL to start.
C:\xampp\mysql\data\aria_log.00000001
C:\xampp\mysql\data\aria_log_control
Please be sure to back up these files before deleting.
Summary
- When MySQL does not start, first check the error logs to understand the cause.
- Be careful not to accidentally delete or overwrite the important
ibdata1
file. - It is also worth trying to delete the
aria_log
related files. - If recovery is still not possible, consider reinstalling XAMPP.