TCPRegistered PortFirewall: Usually Closed
3306

MySQL / MariaDB

What is Port 3306?

Port 3306 is the default port for MySQL and MariaDB, the world's most popular open-source relational database management systems. MySQL was created by Michael Widenius in 1995 and acquired by Oracle in 2010. MariaDB was forked from MySQL by its original creators and maintains wire-protocol compatibility. Port 3306 handles client connections using MySQL's native protocol, supporting authentication, query execution, result set retrieval, and prepared statements. MySQL powers some of the largest websites in the world including Facebook, Twitter, YouTube, and millions of WordPress installations. The LAMP stack (Linux, Apache, MySQL, PHP) and its variants have been the foundation of web development for over two decades.

Common Uses

  • Web application database backends (WordPress, Drupal)
  • Enterprise application data storage
  • Data warehousing and analytics
  • Content management system databases
  • E-commerce platforms (Magento, WooCommerce)

Technical Details

Port Number3306
ProtocolTCP
CategoryRegistered
Service NameMySQL / MariaDB
Default FirewallUsually Closed
Port Test Commands

Copy-paste commands to check port 3306 (MySQL / MariaDB) from your terminal

Test connectivity

Netcat (nc)Check if TCP port is reachable
nc -zv example.com 3306
curl (HTTP)Test HTTP response on this port
curl -v --max-time 5 http://example.com:3306/
TelnetBasic TCP port connectivity check
telnet example.com 3306
nmapScan port 3306 with service detection
nmap -p 3306 -sV example.com
Bash /dev/tcpPure bash TCP check (no extra tools needed)
(echo > /dev/tcp/example.com/3306) 2>/dev/null && echo "open" || echo "closed"

Open port in firewall

UFW (Ubuntu / Debian)
sudo ufw allow 3306/tcp
iptables
sudo iptables -A INPUT -p tcp --dport 3306 -j ACCEPT
firewalld (RHEL / CentOS)
sudo firewall-cmd --permanent --add-port=3306/tcp && sudo firewall-cmd --reload

Security Considerations

!

Never expose port 3306 to the internet. MySQL is constantly scanned for weak credentials. Use strong passwords and disable remote root login. Enable TLS for client connections. Use firewall rules to restrict access to application servers only. Implement MySQL audit logging. Keep MySQL/MariaDB updated and use the mysql_secure_installation script.

Popular Ports Reference

The most commonly used and referenced network ports

Related Ports