`

JoyentJoyent

Knowledge Base

9.5. Connecting remotely to a MySQL database

To connect remotely to a MySQL database on your TextDrive account you’ll need to set up a SSH tunnel from localhost:3306 (your local computer) to localhost:3306 (Textdrive server) on a SSH connection to servername.textdrive.com.

You can do this using Putty (a free Telnet/SSH client for Windows), SSH Tunnel Manager (a similar program for MacOS X), or the ssh command on Linux. There are also other 3rd party solutions which may help you set up tunnels more conveniently.

Once the tunnel is established, you can use any MySQL administration tool to access your databases. In case you already have a local installation of MySQL, you’ll likely have to change your side of the tunnel to use a different port, say 3307, so that the two do not conflict. Just remember to specify the changed port in your MySQL administration tool.

Note: SSH tunneling only works for users who have either ‘scponly’ or the true ‘ssh’ shell access.