Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a mysql database that is only accessible via internal network IP 10.*:3306 and I want to use my local machine to ultimately setup phpmyadmin to admin it, but I'm first just trying to get the SSH tunnel setup. I am running the command ssh -N admin@host_b_public_ip -L 3308:host_b_internal_ip:3306 but the command just hangs in my terminal. If I open another terminal and attempt mysql -P 3308 -u root -p and enter host_b's mysql root password I get denied. Is there anyway I can test if my connection is open? Is this command suppose to just run in a blocking terminal mode or is it not executing properly? Is what I'm trying to do here even possible?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted
  1. Try ssh -f -N *etc*. The -f makes the SSH command run in the background.
  2. Try mysql -h 127.0.0.1 -P 3308 *etc*. The -h 127.0.0.1 tells mysql to try to connect to a network server at localhost, instead of a local server. Because of the port forwarding rule, the network connection is then forwarded to the remote server. If you don't use a -h flag, it just tries to talk to a local MySQL server, and doesn't go over the network at all.
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.