The question your firewall rules not working, is that when a machine is connecting to your DB server, from the point of the DB server, it is indeed the destination port; however when a packet is leaving the DB server, from the point of view of the DB server, the DB service/listening port is the source port.
As such, correcting direct your rules, it should be:
-A INPUT -p tcp -m tcp --dport 50000 -j ACCEPT
-A OUTPUT -p tcp -m tcp --sport 50000 -j ACCEPT
Beware also of the localhost connections which are often needed by several daemons; you might need at the top of your rules:
-A INPUT -i lo -j ACCEPT
-A OUTPUT -i lo -j ACCEPT
Depending on your security requirements, and your number of rules, I would have a look at the the ESTABLISHED and RELATED directives. It would allow you to simplify your rules with stateful firewall aware rules.
ESTABLISHED meaning that
the packet is associated with a connection which has seen packets in both directions, NEW meaning
that the packet has started a new connection, or otherwise associated with a connection which has
not seen packets in both directions, and RELATED meaning that the packet is starting a new
connection, but is associated with an existing connection, such as an FTP data transfer, or an