Port 3306 — MySQL / MariaDB
Default TCP listening port for MySQL and MariaDB relational database server connections.
⚡ Primary Use Cases & Environments
- ✓Web applications (WordPress, Laravel, Node.js) connecting to MySQL
- ✓Database administration via phpMyAdmin or TablePlus
🛡️ Security & Vulnerability Analysis
Never bind MySQL to 0.0.0.0 on an internet-facing server. Set "bind-address = 127.0.0.1" in my.cnf unless remote connections are strictly firewalled.
🔧 Network Diagnostics & Inspection
🔥 Firewall Configuration Rules (UFW & iptables)
❓ Frequently Asked Questions (FAQ)
How do I check if MySQL is listening locally or publicly?
Run "sudo ss -tuln | grep 3306". If it displays "127.0.0.1:3306", it is safely restricted to local connections. If it displays "0.0.0.0:3306", it is exposed to the network.
How do I safely connect to a remote MySQL server?
Use an SSH tunnel: "ssh -L 3307:127.0.0.1:3306 user@remote-host". Then connect your database GUI locally to 127.0.0.1:3307.