使用netsh命令。
具体如下
netsh advfirewall firewall add rule name="mysql" dir=in protocol=tcp localport=3306 action=allow