How to allow connections for specific IP address or subnet and port in UFW?
To allow connections to specific IP subnet and port using UFW firewall, run following command:
sudo ufw allow from 192.168.0.0/16 to any port 3306
Also single IP address can be used:
sudo ufw allow from 192.168.0.1 to any port 3306