Database Ports: MySQL, PostgreSQL, MongoDB, Redis, and More
Reference guide for all major database port numbers. MySQL 3306, PostgreSQL 5432, MongoDB 27017, Redis 6379, and more with security best practices.
Detailed Explanation
Database Port Numbers
Databases use specific ports for client connections. Knowing these ports is critical for connection configuration, firewall rules, and security hardening.
Relational Databases
| Database | Port | Protocol |
|---|---|---|
| MySQL / MariaDB | 3306 | TCP |
| PostgreSQL | 5432 | TCP |
| Microsoft SQL Server | 1433 | TCP |
| Oracle Database | 1521 | TCP |
NoSQL Databases
| Database | Port | Protocol |
|---|---|---|
| MongoDB | 27017 | TCP |
| Redis | 6379 | TCP |
| Cassandra (CQL) | 9042 | TCP |
| CouchDB | 5984 | TCP |
| Neo4j (Bolt) | 7687 | TCP |
| RethinkDB | 28015 | TCP |
In-Memory Stores
| Service | Port | Protocol |
|---|---|---|
| Redis | 6379 | TCP |
| Memcached | 11211 | TCP/UDP |
Security Best Practices
- Never expose database ports to the public internet. Use VPNs or SSH tunnels for remote access.
- Change default ports when possible to reduce automated scanning attacks.
- Use TLS connections — Redis supports TLS on port 6380, MySQL supports TLS on the default port.
- Restrict access by IP in firewall rules to only allow connections from application servers.
# Allow MySQL only from app server
iptables -A INPUT -p tcp --dport 3306 -s 10.0.1.100 -j ACCEPT
iptables -A INPUT -p tcp --dport 3306 -j DROP
Use Case
Configuring a production database server with strict firewall rules that only allow connections from known application servers on the correct database ports.
Try It — Port Number Reference
Related Topics
Web Server Ports: HTTP (80), HTTPS (443), and Alternatives
Web Servers
Common Development Ports: 3000, 5000, 8000, 8080, 8888
Development
Message Broker Ports: Kafka (9092), RabbitMQ (5672), MQTT (1883)
Message Brokers
Container Ports: Docker (2375/2376), Kubernetes (6443), etcd (2379)
Containers & Orchestration
Security-Related Ports: LDAP, Kerberos, RADIUS, and More
Security