I've been trying to set up a SSH tunnel with VPN on my macbook with Big Sur 11.2, but it doesn't seem to work.
On my linux machine, I can simply turn on the VPN and make a SSH-tunnel. Then I can just connect to the MySQL server via port 3307
. If I do the same on my macbook, the SSH tunnel does connect, but I can't connect to the MySQL server on the given port.
My exact steps are:
- Turn on VPN so I can access the server via SSH.
- Run
ssh -g -L 3307:127.0.0.1:3306 user@ip_address
in the terminal. - Run
mysql -u user -p -h [IP] -P 3307
to connect to the MySQL SSH tunnel. - Error:
Can't connect to MySQL server on '[IP]'
.
Above works fine on my linux system, but not on my mac. I am able to SSH to the server with the command, but the tunnel itself is not working.
Is there some reason this is happening, and how should I proceed?