XAMPP中MySQL启动后随即停止问题求助(Apache正常运行)
Hey there, let's work through this MySQL issue together. First, that innodb_additional_mem_pool_size warning you see is just a deprecation notice—it's not the direct reason MySQL is crashing, but we'll address it anyway. The real culprit is probably hiding in the truncated part of your error log, but let's cover all common fixes step by step:
1. Retrieve the Full Error Log
Your shared log cuts off at innodb_empty_free_list_algorithm has been changed to legac...—the rest of this line and subsequent entries will tell us exactly why MySQL is failing to stay running.
- On Windows (if using XAMPP/WAMP), check the complete log file at
[your server directory]/mysql/data/[your-computer-name].err - In control panels like XAMPP, look for a dedicated "Logs" tab under MySQL to view the full output.
2. Remove the Deprecated InnoDB Parameter
Since innodb_additional_mem_pool_size is marked as deprecated, cleaning this up will eliminate warnings and avoid potential config conflicts:
- Open your MySQL config file (usually
my.inion Windows,my.cnfon Linux/macOS) - Locate the line
innodb_additional_mem_pool_size = [some value]and delete it - Save the file and try restarting MySQL
3. Check for Port Conflicts
MySQL uses port 3306 by default—if another program is occupying this port, MySQL can't start properly:
- Windows: Open Command Prompt and run:
Note the PID number, open Task Manager, find that PID, and end the conflicting process.netstat -ano | findstr :3306 - Linux/macOS: Open Terminal and run:
Kill the conflicting process withlsof -i :3306kill [PID]or change MySQL's port in your config file (setport = 3307or another unused port).
4. Fix InnoDB Corruption (A Common Crash Cause)
If the full log mentions InnoDB-related errors, try these steps (always back up your data first!):
- Option 1: Force InnoDB Recovery
Add this line to your config file:
Start MySQL—if it boots successfully, export all your databases withinnodb_force_recovery = 1mysqldump, then stop MySQL, remove the recovery line, and rebuild your databases from the dump. If level 1 doesn't work, try levels 2-6 (higher levels have more aggressive recovery but may result in data loss). - Option 2: Rebuild InnoDB Log Files
- Stop MySQL completely
- Back up
ib_logfile0andib_logfile1from your MySQL data directory - Delete the original log files
- Start MySQL—InnoDB will automatically rebuild fresh log files
5. Verify File Permissions
- Windows: Ensure the MySQL service account (usually
Network Service) has full read/write permissions on your MySQL data directory (e.g.,C:\xampp\mysql\data). Right-click the folder → Properties → Security → Edit → Add the account and grant full control. - Linux/macOS: Run this command to set correct ownership for the data directory:
chown -R mysql:mysql /var/lib/mysql
Once you get the full error log, you can pinpoint the exact issue more quickly—but these steps cover most common causes for this "starts then immediately stops" behavior.
内容的提问来源于stack exchange,提问作者Bauer

