InfraKit 39+ Programmatic Tools

Port 3306 – MySQL / MariaDB Protocol Specification

Technical analysis, security advisories, vulnerability mitigation, and firewall syntax for TCP/UDP port 3306 (MySQL / MariaDB).

Port Number 3306
Transport Protocol TCP
Port Range Type Registered (1024-49151)
Default Status Restricted / LAN

Service Description & Architectural Context

Default connection port for MySQL and MariaDB relational databases.

IANA / RFC Designation:

Port 3306 is assigned to MySQL / MariaDB under the Internet Assigned Numbers Authority (IANA) service name registry. In enterprise infrastructure and homelab setups, services listening on this port must follow the principle of least privilege.

Security Analysis & Attack Surface Assessment
Bind to 127.0.0.1 or internal private network. Avoid wildcard host (%) access.
Hardening Recommendations:
  • Do not expose port 3306 to public WAN interfaces unless authenticated TLS or VPN wrapping is strictly enforced.
  • Enforce rate-limiting using Fail2ban, CrowdSec, or cloud edge DDoS protection.
  • Audit active listening sockets locally: ss -tulpn | grep :3306 or netstat -ano | findstr :3306.

Firewall Rule Snippets for Port 3306

UFW (Ubuntu / Debian Linux)
sudo ufw allow 3306/tcp
iptables (Standard Linux Kernel)
sudo iptables -A INPUT -p tcp --dport 3306 -j ACCEPT
Windows PowerShell (Defender Advanced Firewall)
New-NetFirewallRule -DisplayName "Allow Port 3306" -Direction Inbound -LocalPort 3306 -Protocol TCP -Action Allow

Quick Port Jump