Reference
TCP and UDP ports, explained
A port number identifies a service on a host, not the host itself. This reference covers the ports you meet in logs, firewall rules and connection strings, with the transport and the exposure risk stated plainly.
Three ranges, different rules
IANA divides ports into well-known (0–1023), registered (1024–49151) and dynamic or private (49152–65535). The ranges are conventions for assignment, not enforcement: nothing stops a service from listening on any number, and containers routinely publish high ports that map to low ones.
Opening a port is not the same as running a service. A closed port refuses the connection; a filtered port silently drops it. When a scan reports a port as open, it means something accepted a TCP handshake or answered a UDP probe.
Exposure is the real decision
Web, mail and SSH ports are designed to face the internet. Database, cache and remote-desktop ports are not. Exposing 3306, 5432, 6379, 27017 or 3389 to the public internet invites automated brute force, and for Redis and MongoDB the default configuration has historically allowed unauthenticated access.
The safe pattern is the same for all of them: bind to a private interface, require authentication, and reach them through a VPN, a bastion or an SSH tunnel. A firewall rule that allows the whole internet turns a development convenience into an incident.