Using Sequel Pro with Back To My Mac

I do a lot of development split between two machines, a large desktop machine (iMac) and a portable laptop (Macbook Air), both of which have locally stored MySQL databases. Often I'll run into a situation where I have two out-of-sync databases across the two and I need to access one or the other to replicate changes.

I curse my lack of preparedness: "I should've set up that Dynamic DNS account last time I encountered the problem". But wait doesn't Back to My Mac do exactly what I want, easily and for free? Yes, yes it does.

Unfortunately Back to My Mac isn't an iCloud feature that's integrated across Mac OS, for reasons unknown, it'd be a very useful feature for situations like these. Even so, you can still get access to your remote machines with relative ease.

There's a good article on webdiary.com about SSHing into your iCloud enabled machines via Back to My Mac. Given that we can use SSH to connect to remote repositories in Sequel Pro the rest is childsplay.

Step-by-step instructions for connecting to your repository via Back to My Mac follows:

  1. Get the assigned hostname of your Back to My Mac enabled machines by running dns-sd -B _ssh._tcp on the terminal.
  2. This will give you a tabulated listing of all the machines on your iCloud account you can access.
  3. You'll need the machine name as well as your iCloud hostname that looks something like 12345678.members.btmm.icloud.com.
  4. Once you have that you should be able to connect to the host using hostname.12345678.members.btmm.icloud.com.
  5. Select the SSH option for your connection in Sequel Pro.
  6. Fill in your MySQL details for the machine you're connecting to
  7. Use your iCloud host name as the SSH Host.
  8. You'll be prompted for your SSH password when you try and connect.
  9. You can optionally save the connection to make it easy to get back in.
Sequel Pro with Back To My Mac

That's it. Simple as pie. Of course the remote machine has to be alive and SSH access has to be enabled. Short of any networking oddities at the recipient end you should be logged in querying, exporting and importing happily in no time at all.