Connect to a MySQL database using SSH Tunnelling
You will need SSH to be enabled for this to work. Click here for a guide on doing that.Windows Guide
There are many programs available for creating an SSH tunnel. We will be using Bitvise Tunnelier, which you can download and install here: http://www.bitvise.com/tunnelier-download
Once you have downloaded and installed Tunnelier, you will need to configure it.
How to configure Tunnelier:
- Under the Login tab, enter in the following information --
- Server Host: Your Domain Name
- Username: The cPanel username for your account
- Password: The cPanel password for that account
- Change the Initial Method to "password"
- Tick the box for Store encrypted password in profile
- Under the Options tab untick Open Terminal and Open SFTP
- Under the C2S Fwding tab you will need to add some details about the connection forwarding.
Click the Add button and enter these details:
enabled 127.0.0.1 3306 DomainName 3306 MySQL
However, if for some reason that you are running a MySQL server on your PC (you probably are not), then change "List. Port" to 3308 for example - You are now ready to connect to your Web Hosting Account using the SSH tunnel.
Click the Login button on the bottom left-hand side of the program. - Click the Accept and Save button when the Host Key Verification window when it pops up
You will now be able to see the results of your connection attempt in the Log window. After the connection has been established, load whichever program that you are using to access your databases and configure it to connect to localhost (or 127.0.0.1) on port 3306 (or port 3308 if you set it to that instead).
Click the Logout button to close the connection.
Mac Guide
Step 1 - Open the Terminal application from Go > > Applications > Utilities
Click on Terminal
Step 2 - In the Terminal, run the following command: ssh cpanelusername@hostip -Llocalport:127.0.0.1:3306
Cpanelusername your cpanel account username
hostip the IP address off your server
localport a random port number (1211 is safe as it’s not a standard port)
Your SSH Tunnel should now be working