Importing MySQL on WordPress Cloud Instance

Prerequisites: MySql, VMC, AppFog installed

In prevouse post, i deployed my first PHP app on Cloud. The reasoning for doing was, so i don’t have to configure and maintain my local development infrastructure(Apache, PhpMyAdmin,etc). So, I make a change following with push to cload and the resulting instance on cloud is my development solution ready for testing, however. In order to do, we need import data into MySql on the cloud instance to keep it in sync with production environment. This post is exactly how we accomplish it with ColdeCott  – an extension of CloudFoundry that lets run commands on MySql instance residing on cloud feeding our PHP App

Step 1 – Install DevKit and ColdeCott

DevKit is needed, so we are able to install ColdeCott. To install DevKit, go to rubbyinstaller page and download DevKit. Afterwards, extract DevKit and in ‘Command Line with Ruby’ go to the folder where you extracted DevKit and run the following:

In the above screen shot, the last command was run to install ColdeCotte – ‘get install CaldeCotte’

Step 1 For Mac – Install ColdeCott via XCode

For Mac environments, the Coldecott is installed via XCode as follows:

sudo xcode-select -switch /Applications/   
sudo gem install caldecott

Step 2 – Connect to MySql instance

To connect with the particular MySql instance feeding your app, we use a command ‘tunnel’ from Command Line with Ruby  that establishes the connection. Here is the screen shot:

!!! Before tunneling make sure you are logged in by running ‘af login -u appFogUsername’

The Shell on the left you tunnel(connect to) MySQL instance and afterwards, you are able to run any inquiries you like via mysql command. As you can also see while connecting MySQL, it displayed the current instance username, password and database name that you will need next step when importing data.

Step 3 – Import Data

Once you tunneled in your MySql instance (see shell on the left in the above screen shot), you can use another shell from which you can run mysql command to import data as it is displayed in the shell on the left of the screen shot above

Alternative is to use MySql Workbench with the same credentials given to you in Step 2

!!! Once you close the tunnel(shell), the connection is lost with the MySql instance

!!! The credentials seems to stay the same next time you open connection(tunnel) into the MySql instance

After data imported, we have  our development WordPress app working in sync with production and available for testing without much developers configuring and setting up Apache, PhpMyAdmin,MySql,PHP,etc. Next would be nice to have  Gradle script to do all this for us, so that once me make change, it auto updates our cloud instance but that will be another post….till then, happy coding!


‘Manage you AppFog data from workstation’ by Jeremy Voorihs

Documentation Installing WebKit by the RubyInstaller Google Group


Leave a Reply

Your email address will not be published. Required fields are marked *