port 3306 · MySQL / MariaDB
Port 3306 — MySQL / MariaDB
Port 3306 is the IANA default for MySQL and MariaDB (drop-in replacement). Verify with `lsof` before connecting; MySQL and MariaDB present identically on the wire but have small SQL dialect differences.
beginner
MySQL / MariaDB
Find the process + connect / kill
lsof -i :3306 # Identify which: MySQL or MariaDB? mysql -h 127.0.0.1 -P 3306 -u root -p -e 'SELECT VERSION();' # 8.0.36 → MySQL # 10.11.6-MariaDB → MariaDB # Stop: brew services stop mysql # Homebrew systemctl stop mysql # Linux docker stop <container> # Docker
Typical services on this port
- MySQL server (5.7, 8.0, 8.4)
- MariaDB server (10.x, 11.x)
- Percona Server
- Docker mysql / mariadb image
Alternatives
MariaDB sometimes runs on 3307 to coexist with MySQL. ProxySQL often on 6033. Galera cluster nodes use 4567/4568.
Common pitfalls
| Input | Result |
|---|---|
| ⚠ MySQL 8 changed default authentication to `caching_sha2_password` — older clients (PHP, libmysqlclient<8) can't connect. Either upgrade client or set `mysql_native_password` per-user. | |
| ⚠ Killing mysqld with `kill -9` can corrupt InnoDB. Use `mysqladmin shutdown` for graceful stop. | |
| ⚠ Docker mysql + native mysql — same port conflict pattern as Postgres. Map host port differently. | |
Edge cases & caveats
Common use cases
- Verify MySQL/MariaDB install
- Distinguish MySQL from MariaDB
- Diagnose connection failures
- Multi-server testing
See what's bound to your local ports
portcheck shows pid, command, user, address — faster than netstat, simpler than ss. Linux + macOS, zero dependencies, MIT-licensed.
Open portcheck
Related
Node.js dev server (default) · Alternate HTTP / proxies / Tomcat · Cheatsheet of common dev ports · PostgreSQL