Yes, this is what is called a tunnel.
Assuming host A is running the mysql server and host B is the one that dose not.
To create the tunnel enter the following on host B:
ssh -L 3306:localhost:3306 username@A
(Add -f -N
to the command to not execute any command on the remote host and immediately background the ssh connection).
This creates a listening port 3306
on host B which is forwarded over the ssh tunnel to localhost:3306
on host A.
Now just run mysql
on host B and you should be able to connect to the mysql server on host A.
Hope it helps!