Paul wrote:
I want to run MySQL on server but it only be accessible to programs on
localhost. I see that port 3306 is open on server so I need to close
it.
How do I do that while keeping it available to programs running on
localhost?
One solution is to enable the option in your my.cnf file:
bind-address=127.0.0.1
This means that only clients connecting from the specified IP address
are permitted to connect.
But this is not the same thing as closing port 3306 to the outside
world. A port-detection tool would still show the port as "open," even
though the application listening on the port (mysqld) will refuse all
connections unless they come from the local IP address.
So as torpedocool says, the better solution is to configure your
firewall rules in the way you want.
Regards,
Bill K.