How to block mysql port 3306 for everyone, but allow it for a specific IP address? This is what I am doing now:
iptables -I INPUT 1 -p tcp --dport 3306 -j ACCEPT
For this you need a few rules. In most cases, what happens to the join depends on the first rule that it matches. So, first we accept the connection of our friends, and secondly, we drop someone else. Voila!
iptables -I INPUT 1 -p tcp -s 1.2.3.4 --dport 3306 -j ACCEPT iptables -I INPUT 2 -p tcp --dport 3306 -j DROP