升级Mac High Sierra 10.13.2后MAMP/AMPPS/XAMPP中MySQL Server无法启动求助
Hey there, let’s work through this frustrating MySQL problem you’re dealing with—since it’s happening across MAMP, AMPPS, and XAMPP, it’s clearly a system-level conflict or leftover issue from the OS upgrade, not just a single stack problem. Here’s a step-by-step breakdown to fix it:
1. Check for Conflicting System-Level MySQL Processes
Mac High Sierra might have a pre-installed or leftover MySQL daemon running in the background that’s hogging the 3306 port or interfering with your AMP stack’s MySQL.
First, list all running mysqld processes:
ps aux | grep mysqldLook for any processes owned by
rootor_mysqlthat aren’t tied to your MAMP/AMPPS/XAMPP installation (the paths should show something like/Applications/MAMP/Library/bin/mysqldfor MAMP).If you find an unrecognized mysqld process, stop it by unloading its launch daemon:
# Replace with the actual plist file name if different sudo launchctl unload -w /Library/LaunchDaemons/com.mysql.mysqld.plistCommon plist names include
com.oracle.oss.mysql.mysqld.plistorcom.mysql.mysql.plist—check the/Library/LaunchDaemons/folder for any MySQL-related files.
2. Inspect MySQL Error Logs for Exact Failures
The error log will tell you why MySQL won’t start—this is the most critical step. Here’s where to find logs for each stack:
- MAMP:
/Applications/MAMP/logs/mysql_error_log.err - XAMPP:
/Applications/XAMPP/xamppfiles/var/mysql/[your-mac-hostname].err - AMPPS:
/Applications/AMPPS/logs/mysql.err
Open the log file and look for recent entries (towards the bottom). Common issues you might see:
- Permission errors on data directories
- Corrupted InnoDB log files
- Port conflicts
- Invalid configuration settings in
my.cnf
3. Fix Directory Permission Issues
OS upgrades often reset file permissions, which can prevent MySQL from accessing its data or log files.
Locate your MySQL data directory:
- MAMP:
/Applications/MAMP/db/mysql - XAMPP:
/Applications/XAMPP/xamppfiles/var/mysql - AMPPS:
/Applications/AMPPS/mysql/data
- MAMP:
Set the correct owner and permissions for the directory:
# Replace [data-directory-path] with the actual path above sudo chown -R _mysql:_mysql [data-directory-path] sudo chmod -R 755 [data-directory-path]
4. Validate and Adjust MySQL Configuration (my.cnf)
Outdated or incompatible settings in my.cnf can break startup after an OS upgrade.
Find your
my.cnffile:- MAMP:
/Applications/MAMP/conf/my.cnf - XAMPP:
/Applications/XAMPP/xamppfiles/etc/my.cnf - AMPPS:
/Applications/AMPPS/mysql/etc/my.cnf
- MAMP:
Check these key settings:
innodb_log_file_size: If you previously deletedib_logfile0/ib_logfile1, make sure this value matches what MySQL expects (or comment it out temporarily to let MySQL auto-generate the correct log file size).bind-address: Ensure it’s set to127.0.0.1(local only) to avoid network conflicts.port: Confirm it’s set to3306(or a different port if you intentionally changed it, but make sure no other process is using that port).
5. Fully Clean Up MySQL Residues Before Reinstalling
If reinstalling stacks didn’t work, leftover system files are likely causing the issue. Uninstall your current AMP stack, then delete these MySQL-related files/folders:
/Library/LaunchDaemons/: Any MySQL.plistfiles/Library/StartupItems/MySQLCOM(if it exists)/usr/local/mysql(if this folder exists)~/Library/Application Support/: MAMP/AMPPS/XAMPP folders/var/db/receipts/: Any MySQL-related.pkgreceipt files
After deleting all residues, restart your Mac, then reinstall your preferred AMP stack.
6. Verify Port 3306 Isn’t Occupied by Another App
Use this command to check if any process is using port 3306:
sudo lsof -i :3306
If you see a process other than your AMP stack’s MySQL, kill it with:
sudo kill -9 [PID]
(Replace [PID] with the process ID from the lsof output.)
内容的提问来源于stack exchange,提问作者fransBernhard

