Navigation
Included with all plans
Root Access
99-Day Money-Back Guarantee
Undercrowding
Phone Support
Premium Connectivity
99.99% Uptime
Free Website Accelerator
1GB Email Accounts
Convenient Control Panel
... and much more!
 
Document Actions

MySQL SSH Tunnel Howto

You would like to connect to your MySQL databases hosted on your HSR account but you can't do so directly because if we allowed that, it would open a security hole. Is there a workaround? Absolutely. Read on for the howto.

MySQL SSH Tunnel Howto

If your home/office/client computer is using Linux/Unix/BSD/OS X as its operating system then you can do the following:

Open up a Terminal/xterm session.

Edit your ~/.ssh/config file. You may have to create the directory ~/.ssh first, if you don't already have it, but you probably do. If ~/.ssh doesn't exist, be sure to chmod 700 it after you create it.

vi ~/.ssh/config

Enter the following into this file.

Host name_for_my_account
Hostname account_ip_address
User my_user_name
Localforward 3306 localhost:3306

The value for name_for_my_account is entirely at your discretion. You could, for example, set it to:

my-wonderful-hsr-account

You can get the value for account_ip_address by logging in to your account via SSH and typing:

dnsip `hostname`

my_user_name is your ssh username.

Now to open the forwarding connection, just run the following command in your local Terminal/xterm sessions:

ssh my-wonderful-hsr-account

This enables the forward and you get a normal SSH session as a bonus. :)

If you get the following error:

bind: Address already in use

... then log out and try changing Localforward 3306 localhost:3306 to the following:

Localforward 3307 localhost:3306  

... and log in again.

This is useful if you like to use client-side SQL browsers such as CocoaMySQL, Navicat, etc.

Questions?

Please contact us with your questions and we will get back to you right away.

Creative Commons License


© 2005-2006 High Speed Rails incorporated

701 Fifth Avenue, Suite 4200
Seattle, Washington 98104
+1 206-774-8566
+1 800-969-1452
UK: 020-7101-9307 (2PM-12AM BST)
Mexico: 55-5351-2449 - Se Habla Español
France: 01-7281-3666 (3PM-1AM CET)
Italia: 068 7720079 (3PM-1AM CET)

Powered by Plone Powered by High Speed Rails

2Checkout is an authorized retailer of our services.