I tried to connect to a remote MySQL instance from my script in WSL2 but it always failed. I tested using the following command Test-NetConnection -ComputerName my-db.com -Port 3306
from PowerShell v7 and got this result:
ComputerName : my-db.com
RemoteAddress : 123.123.123.123
RemotePort : 3306
InterfaceAlias : Wi-Fi
SourceAddress : 192.192.192.192
PingSucceeded : False
PingReplyDetails (RTT) : 0 ms
TcpTestSucceeded : False
I've checked the firewall rules and I don't see any rule regarding port 3306. I've tried using VPN too to no avail. I'm really at my wit's end.
EDIT: And yes, the remote server is open on that port because I can connect to it using MySQL Workbench.