I’m trying to do ssh-tunnelling via local forwarding to a remote MySQL host reached via a non-standard (port-forwarded) ssh port of 2200 mapped internally to the server’s port 22.
First of all, I know this is possible, because I can configure MySQL Workbench to make such a connection. (MySQL Workbench provides built-in ssh-tunnelling connections). In the configuration of the SSH host I put mysql-server:2200 and configure the rest of the connection normally and it just works.
The problem is when I try to make a permanent ssh tunnel using the non-standard destination port of 2200. The standard command (default port 22) is of the form:
ssh -g -C -N -L 3307:127.0.0.1:3306 mysql-server
I just cannot find the place to put the non-standard ssh destination port. It causes a host key verification error with this form:
ssh -g -C -N -L 3307:127.0.0.1:3306 -p 2200 mysql-server
It gives a non-resolvable destination host with this form:
ssh -g -C -N -L 3307:127.0.0.1:3306 mysql-server:2200
It give a connect to host time out with this form:
ssh -g -C -N -L 3307:127.0.0.1:3306 mysql-server 2200
It gives (another) host key verification error with this form:
ssh -g -C -N -L 3307:127.0.0.1:3306 mysql-server -p 2200
Placing the 2200 port in ~/.ssh/config under mysql-server makes no difference.
How do I get this to work?
-p 2200
is the right syntax. Host key verification error means some SSH server responded. What is the exact error message? Does it mentionknown_hosts
? Doesn't it tell you what to do?