BFCM20 · 20% Off⚡ New in v1.7.1: 1-Click MCP Server for Cursor & Claude Code — Lock in the $89 → $71.20 Founder Lifetime License with code BFCM20 (Save $207+/yr vs Herd Pro)Claim Founder Tier →
Stratosv1.7.1
Troubleshooting & Fixes• 3 min read

Fix MySQL (3306) & Redis (6379) Port Already in Use on macOS

Diagnose and resolve Address already in use (3306, 5432, 6379, 80, 443) conflicts caused by Homebrew, Docker, DBngin, or stale PIDs on macOS.


Why Ports 3306, 5432 & 6379 Conflict on macOS

When starting local databases or web servers, seeing Bind for 0.0.0.0:3306 failed: port is already allocated or Could not create socket on port 6379 almost always means a background daemon from Homebrew (brew services), Docker Desktop, OrbStack, DBngin, or an ungracefully stopped process is already listening on loopback.

Method 1: Instant Check via Stratos Site Doctor

Stratos runs a microsecond-level native C BSD socket scan (socket(), bind()) across ports 80, 443, 3306, 5432, and 6379 and inspects occupying processes with /usr/bin/lsof -n -P right inside the Site Doctor / Ports panel.

Method 2: Terminal Diagnostics & Clean Handover

Check what owns each standard port right now in Terminal:

lsof -nP -iTCP:3306 -sTCP:LISTEN
lsof -nP -iTCP:6379 -sTCP:LISTEN
lsof -nP -iTCP:5432 -sTCP:LISTEN
lsof -nP -iTCP:80,443 -sTCP:LISTEN

Stop Conflicting Homebrew Background Services

brew services list
brew services stop mysql
brew services stop mariadb
brew services stop redis
brew services stop postgresql@16
brew services stop nginx

Stop Conflicting Docker Containers

docker ps --format "table {{.Names}}\t{{.Ports}}"
docker stop $(docker ps -q)

MySQL Unix Socket Fallback on macOS

If CLI scripts fail to connect via TCP 127.0.0.1:3306 while a local MySQL instance is running via socket, inspect your socket paths (/tmp/mysql.sock or ~/Library/Application Support/Stratos/mysql.sock) and ensure Laravel’s .env sets DB_HOST=127.0.0.1 cleanly.

Need to check SSL/DNS port issues too? Run our open-source diagnostic helper:

curl -fsSL https://stratosapp.dev/tools/macos-local-ssl-doctor.sh | bash

Explore Site Doctor → Database Hub Setup →