SUBSCRIBE VIA RSS


Subscribe to our feed

Symfony Experts

Symfony Experts
If you have an urgent question for a symfony-related issue, this is the place to ask.

Topics

Stack Overflow


The old fashioned way

RECENT TUNES

May 22, 2007 – 11:20am How to set up an SSH tunnel to a remote MySQL server

If you have SSH access to your hosting account and want to use a GUI to view your MySQL databases on that remote server, you can set up an SSH tunnel and use a program like CocoaMySQL to manage your remote database. When it works, it can be really userful and is a nice break from a web-based solution like phpMyAdmin.

First, make sure you can login to your host through SSH. After you are certain it works, you can open up a tunnel like this:

ssh -L 3307:[ip address of host]:3306 [username]@[ip address of host] [-p ssh portnumber]

This opens up a tunnel from your local port 3307 to port 3306 on the remote host. Here is the example again with dummy data, using a non-standard ssh port 8022:

ssh -L 3307:192.168.2.1:3306 user@192.168.2.1 -p8022

Once that connection is set up, fire up your MySQL GUI and connect to your local IP address (127.0.0.1) and specify the new port you set up in your tunnel (3307). Here is how it looks in CocoaMySQL.

CocoaMySQL Connection

Posted by in  OS X Web Development   |  

Comments are closed.