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
Copy-paste commands to check port 3306 (MySQL / MariaDB) from your terminal
Test connectivity
nc -zv example.com 3306
curl -v --max-time 5 http://example.com:3306/
telnet example.com 3306
nmap -p 3306 -sV example.com
(echo > /dev/tcp/example.com/3306) 2>/dev/null && echo "open" || echo "closed"
Open port in firewall
sudo ufw allow 3306/tcp
sudo iptables -A INPUT -p tcp --dport 3306 -j ACCEPT
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