Solution 1:

To allow a port

sudo ufw allow 3306

if its ufw is not installed is probably iptables

sudo iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT