I am attempting to daisy chain tunnels/ports to access mysql on a secured server. Without opening up iptables, I would like to, from my local machine:
mysql -uadmin_user -p -hlocalhost:8002
and have it jump ssh tunnel connections through to the servers ultimately to remote2.private-ip:3306 as described in my set-up screenshot.
I had been trying this for a while, and I gave up with the 3 way hop for now and I have been attempting to get it working with 1 and remote 2 connected first. I still can't get that to work yet either. Then I went to remote2 and I can't get the tunnel to work on remote2-private either.
Initially I used
remote2: ssh -f -N -M -S ~/.ssh/sockets/remote2-private-tunnel.sock -t -A -R 8002:localhost:3306 firstname.lastname@example.org
And then I tried:
remote2:ssh -f -N -R 8002:remote2.private-ip:3306 remote2.public-ip
And with both of those, I cannot from remote2:
remote2: mysql -uadmin_user -p -hremote2.public-ip:8002
I can tell it is not getting to the mysql server because I get the error
ERROR 2005 (HY000): Unknown MySQL server host 'remote2.public-ip:8002' (0)
instead of something similar like:
ERROR 1045 (28000): Access denied for user 'admin_user'@'remote2.private-ip' (using password: YES)
I feel like I am just overwhelmed here and am missing something simple that I should be seeing. Any help would be much appreciated.
I should note, SSH keys are being used, and connectivity is established ssh'ing to them normally. Also, normal mysql connection to remote2.private-ip is also working. Also remote1 and remote2 are both joined on private networking and mysql from remote1.private-ip CLI to host remote2.private-ip works as well.