tools / port reference / mysql / mariadb
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

Alternatives

MariaDB sometimes runs on 3307 to coexist with MySQL. ProxySQL often on 6033. Galera cluster nodes use 4567/4568.

Common pitfalls

InputResult
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

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