From my local machine, I have SSH access to server A. Once on Server A, I connect to mysql on server B via port 3306 on server B.
mysql -h <B.hostname> -P 3306 -u <username> -p
I do NOT have ssh access to server B, either from my local machine or from server A.
What I'd like to do is have access to mysql on server B from my local machine. Every tunneling/port-forwarding link I've found assumes that I can ssh into server B.
ssh's -L takes a local port, a remote hostname to connect from the ssh server you connect to, and the remote port. In this case, you'll run:
ssh -L 3307:B.hostname:3306 A.hostname
This will make ssh connect to A, and when you later connect to port 3307 using a local mysql client (mysql -H localhost -P 3307 -u ...
), A's sshd will initiate a connection to B.hostname:3306 for you.