Skip to main content
PORT 3306 / TCPDatabase & CacheExposure Risk: Critical

Port 3306: MySQL / MariaDB — MySQL & MariaDB Relational Database

Default port for MySQL, MariaDB, and Percona Server connections. Should never be bound to 0.0.0.0 on public servers without firewall restrictions.

Default Service
MySQL / MariaDB
Process: mysqld / mariadbd
Transport Protocol
TCP
IANA Registered Port 3306
Docker Port Flag
-p 3306:3306
Container to Host Mapping

How to Check & Kill Process on Port 3306 (EADDRINUSE Fix)

macOS & Linux (lsof / kill)
# Find process using port 3306
sudo lsof -i :3306

# Instantly kill process on port 3306
lsof -ti:3306 | xargs kill -9
Windows (PowerShell & CMD)
# Find PID listening on port 3306
netstat -ano | findstr :3306

# Force kill by PID
taskkill /PID <PID_NUMBER> /F
Cross-Platform Node.js One-Liner
# Kill port 3306 via npx
npx kill-port 3306

# Or diagnose via Castov CLI
npx castov fix "EADDRINUSE :::3306"
Linux Firewall (UFW) & Connectivity Test
# Test if port 3306 is reachable
nc -zv localhost 3306

# Allow or deny port 3306 in UFW
sudo ufw allow 3306/tcp

Frequently Asked Questions about Port 3306

What is Port 3306 used for?

Port 3306 is the standard network port for MySQL / MariaDB (MySQL & MariaDB Relational Database) operating over TCP. The typical system daemon or process is mysqld / mariadbd.

How do I kill a process running on Port 3306 (EADDRINUSE)?

On macOS and Linux, run: lsof -ti:3306 | xargs kill -9 (or npx kill-port 3306). On Windows PowerShell/CMD, run: netstat -ano | findstr :3306 and then taskkill /PID <PID> /F.

Is it safe to expose Port 3306 to the internet?

Port 3306 has a Critical security risk profile. Default port for MySQL, MariaDB, and Percona Server connections. Should never be bound to 0.0.0.0 on public servers without firewall restrictions.

Other Common Network Ports