How to connect and manage your Rackspace Cloud Server locally on your computer

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.

Prerequisites

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:

  1. Download plink.exe and save it to your C:\ drive.
  2. 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]
    
  3. After completing the above commands, you will most  likely see a message saying “The server’s host key is not cached….”
    Enter y when it asks Store key in cache?
  4. When prompted for a password, Enter your Cloud Server root user password.
  5. 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.

  1. Download & Install  HeidiSQL
  2. Open HeidiSQL and go to the Session Manager.
  3. Create a New Session clicking the New button
  4. On the Settings tab, enter the following:
    Network Type: SSH Tunnel
    Hostname/IP: [HOSTNAME OF CLOUD DATABASE INSTANCE]
    User: [CLOUD DATABASE USERNAME]
    Password: [CLOUD DATABASE PASSWORD]
    Port: 3307
    Uncheck Compressed client/server protocol
    Databases: 
    [CLOUD DATABASE NAME(S)] –  comma separated if more than one database.
  5. 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]
    Username: [CLOUD SERVER SSH USERNAME]
    Password: [CLOUD SERVER SSH PASSWORD]
    Private Key File: Not needed, leave blank.
    Local Port: 3307
  6. Click the Open button at the bottom. You should now be connected to your cloud database.

One Comment

  1. Hi

    A quick point here – when using Rackspace’s servers to host your MySQL DB – you should use the private network to connect to your web servers and then you need to use this Plink method to connect via SSH to use Heidi SQL. If you do this then the settings need to be as follows:

    On the Settings tab, enter the following:
    Network Type: SSH Tunnel
    Hostname/IP: IP Address of your internal network card (this is what MySQL should be bound to in my.cnf)
    User: [CLOUD DATABASE USERNAME]
    Password: [CLOUD DATABASE PASSWORD]
    Port: 3306

    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] Port 22
    Username: [CLOUD SERVER SSH USERNAME]
    Password: [CLOUD SERVER SSH PASSWORD]
    Private Key File: Not needed, leave blank.
    Local Port: 3307

    Best regards

    Phil

Leave a Reply