MySQL Database won't start in XAMPP Manager-osx
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
When MySQL fails to start in XAMPP on macOS, the cause is usually a port conflict (another MySQL or MariaDB instance using port 3306), corrupted data files, incorrect file permissions, or a stale PID file. The XAMPP Manager (manager-osx) shows MySQL as "stopped" and clicking Start has no visible effect. This article covers the most common causes and step-by-step fixes, starting from the most likely culprit (port 3306 conflict) to less common issues (data corruption).
Fix 1: Port 3306 Conflict (Most Common)
Another MySQL instance (from Homebrew, a standalone installer, or macOS built-in) may already be using port 3306.
Check What Is Using Port 3306
Kill the Conflicting Process
Stop Homebrew MySQL/MariaDB
Change XAMPP MySQL Port
If you need both instances, change XAMPP's MySQL port:
Then restart XAMPP. Connect to MySQL with the new port:
Fix 2: Remove Stale PID File
MySQL uses a PID file to track whether it is running. If MySQL crashes, the PID file may not be cleaned up, preventing a restart.
Fix 3: Fix File Permissions
XAMPP's MySQL needs correct ownership on its data directory:
If you are unsure of the correct user:
Fix 4: Check Error Logs
The error log reveals exactly why MySQL failed to start:
Common log messages and their fixes:
| Log Message | Meaning | Fix |
Can't start server: Bind on TCP/IP port: Address already in use | Port 3306 is taken | Kill the other process or change port |
InnoDB: Unable to lock ./ibdata1 | Another mysqld holds the lock | Kill the other MySQL process |
Table 'mysql.user' doesn't exist | System tables missing | Run mysql_install_db |
InnoDB: Corruption in redo log | Redo log corrupted | Delete ib_logfile0/1, restart |
Fix 5: Start MySQL from Terminal
Bypass the XAMPP Manager and start MySQL directly to see error output:
The terminal output shows startup errors that the XAMPP Manager GUI does not display.
Fix 6: Reinstall MySQL Data Directory
If data files are corrupted beyond repair:
This creates fresh system tables but erases all existing databases. Import your backups after reinitializing.
Fix 7: InnoDB Recovery
If InnoDB crashes with redo log errors:
Common Pitfalls
- Installing MySQL via Homebrew alongside XAMPP: Both try to use port 3306. Either uninstall the Homebrew version (
brew uninstall mysql), stop it (brew services stop mysql), or change one instance's port. Running two MySQL servers on the same port is the number one cause of this issue. - Not checking error logs before trying fixes: The error log (
/Applications/XAMPP/xamppfiles/var/mysql/$(hostname).err) tells you exactly what went wrong. Random troubleshooting without reading the log wastes time and risks making the problem worse. - Deleting InnoDB files without backing up first: Removing
ibdata1,ib_logfile0, orib_logfile1without a backup destroys all InnoDB table data permanently. Always copy the entiremysqldata directory before deleting any files. - Running XAMPP commands without
sudo: XAMPP's MySQL on macOS requires root privileges to start because it binds to port 3306 (a privileged port on some configs) and accesses its data directory. Omittingsudocauses silent permission failures. - Ignoring macOS security prompts: macOS may block XAMPP's MySQL binary due to Gatekeeper or quarantine attributes. Check System Preferences > Security & Privacy if MySQL fails to start after a fresh XAMPP install, and allow the binary to run.
Summary
- Check port 3306 for conflicts first with
sudo lsof -i :3306— this is the most common cause - Remove stale PID files from
/Applications/XAMPP/xamppfiles/var/mysql/ - Read the error log (
*.errfile) for the exact failure reason before trying random fixes - Start MySQL from the terminal (
mysqld_safeorxampp startmysql) to see error output the GUI hides - Fix permissions with
sudo chown -R mysql:mysqlon the data directory if ownership is wrong

