If you’re familiar with Rackspace Cloud Databases, you are probably aware that you cannot directly connect to your database remotely (outside of the Rackspace internal network).
You can, however, use an SSH Tunnel to access your database remotely through a rackspace cloud server instance. Here’s how.
- You must have a Rackspace Cloud Server Instance with SSH Access
- You must have a Rackspace Cloud Database Instance, with a Database, User & Password assigned to it.
Step 1: Connect to Cloud Server from PC
First, we must connect to our Cloud Server using SSH to store the server host key locally. To do this, do the following:
- Download plink.exe and save it to your C:\ drive.
- Open up Command Prompt, and do the following commands:
Replace [CLOUD SERVER IP ADDRESS] with the IP address of your cloud server.
cd C:\ plink.exe -L 3307:[CLOUD SERVER IP ADDRESS]:3306 root@[CLOUD SERVER IP ADDRESS]
- After completing the above commands, you will most likely see a message saying “The server’s host key is not cached….”
ywhen it asks Store key in cache?
- When prompted for a password, Enter your Cloud Server root user password.
- You should now be connected to your cloud server using an SSH connection.
Step 2: Connect Using MySQL Management Software
Now we should be able to connect using a MySQL management tool such as HeidiSQL, which is a completely free solution that offers SSH Tunneling.
- Download & Install HeidiSQL
- Open HeidiSQL and go to the Session Manager.
- Create a New Session clicking the New button
- On the Settings tab, enter the following:
Network Type: SSH Tunnel
[HOSTNAME OF CLOUD DATABASE INSTANCE]
[CLOUD DATABASE USERNAME]
[CLOUD DATABASE PASSWORD]
Uncheck Compressed client/server protocol
Databases: [CLOUD DATABASE NAME(S)] – comma separated if more than one database.
- On the SSH Tunnel tab, enter the following:
plink.exe location: Download plink.exe, and point this to it’s location
SSH Host + port:
[CLOUD SERVER HOSTNAME or IP]
[CLOUD SERVER SSH USERNAME]
[CLOUD SERVER SSH PASSWORD]
Private Key File: Not needed, leave blank.
Local Port: 3307
- Click the Open button at the bottom. You should now be connected to your cloud database.