Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am working on a client's website and he has hosting through 1and1. They don't allow connecting directly to their mySQL server from anywhere. I can't for instance load up a mySQL GUI on windows and just connect and work on the databases, it says host not found. His hosting account on the other hand is given access to the mySQL server even though it is in a different location. Let's say these are the servers I'm working with:

His main hosting:
Address: thehost.com
Username: joe

His mySQL server:
Address: mysqlserver.com
Port: 3306
Database: thedata
User: dbouser

The main hosting account he has comes with SSH. So if I SSH into thehost.com on port 22 and then use the mysql command to connect to mysqlserver.com, it works. I have tried to set up SSH tunneling but the problem is that it's not the mySQL server that has SSH allowed, it's the main hosting. How do I set up SSH Tunneling on both a Mac and a Windows machine so that I can run any GUI I want and I will be able to connect to the mysqlserver.com server. All based on the information above that SSH access is to thehost.com only, and thehost.com itself can connect to mysqlserver.com.

share|improve this question

5 Answers 5

MySQL Workbench can do the SSH tunnelling for you and it is available on most platforms.

http://dev.mysql.com/doc/workbench/en/wb-manage-db-connections-ssh.html http://dev.mysql.com/downloads/workbench/

share|improve this answer

On Mac, Sequel pro allows you to do by default but I'm still looking for a windows gui client to do it.

share|improve this answer

I think a 50% solution is to use the -Y ssh option, assuming that the host machine has the GUI that you want.

From the ssh man page:

 -Y      Enables trusted X11 forwarding.  Trusted X11 forwardings are not
         subjected to the X11 SECURITY extension controls.

So from your PC/Mac ssh -Y joe@thehost.com

Then while you're on thehost.com joe@thehost.com> /usr/bin/mysql-query-browser

And add in the mysqlserver.com information. Should funnel the mysql browsing UI back to your Mac/PC.

share|improve this answer
ssh -L9999:mysqlserver.com:3306 joe@thehost.com

then tell your MySQL Gui to connect to localhost:9999

share|improve this answer

Assuming MySQL is on standard 3306 port, you just issue this command on Unix/OSX:

ssh -L3306:localhost:3306 username@host

Then you connect to localhost with your GUI.

share|improve this answer
    
if you are using putty, you can also set it up in its GUI - just follow this document: cs.uu.nl/technical/services/ssh/putty/puttyfw.html –  nhek Dec 14 '09 at 19:16
4  
Which would work perfectly, unless of course, you actually read the question. –  Swoogan Dec 14 '09 at 19:20

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.