Posts Tagged ‘ dropbox ’

Tutorial: Use DropBox to Share a Database (or any file)

Friday, January 14th, 2011

Admittedly, this is a niche problem, but it’s one I run into quite frequently. I have several development machines, and it used to be a huge pain in the but to keep my MySQL databases synced between them all so that I’m always working with the same data.

Enter DropBox and symbolic linking on the Mac (sorry Windows users).

In your DropBox folder, create a folder that will hold your shared databases. In recent versions of DropBox, you’ll want to ensure that this folder is not excluded from syncing on your target machines.

Quick steps:

  1. Back up your db files
  2. Move the db folder you want to share from your MySQL db directory to its DropBox counterpart
  3. Create a symbolic link from the DropBox version to your MySQL directory

Detailed steps:

On your primary development machine (or the one with the latest version of the database you wish to share), navigate to the folder containing your MySQL database files (For MAMP installations, this is typically /Applications/MAMP/db/mysql).

WARNING: BACK UP YOUR DATA BEFORE PROCEEDING!

Now move the folder containing the database you wish to share to your newly created counterpart in your DropBox folder. Move it, don’t copy it.

Fire up your terminal window. You’re going replace the folder you just moved with a symbolic link (not an alias!) from your DropBox version. DropBox folders can live anywhere you choose, so replace this example with your own paths:

ln -s /Users/Steve/Dropbox/Databases/example_db /Applications/MAMP/db/mysql/

Now you should see the DropBox version of your db folder there in the finder. Because it’s a symbolic link, MySQL is tricked into seeing the shared directory even though it’s no longer in your database directory.

Repeat this on every machine on which you wish to share this database.

Some caveats: this is a development solution only! Obviously, you will not use this technique on your live database! Also, this technique is susceptible to version control errors. Hence, it’s a good solution when you’re the only developer hitting the database files. My own use-case, for example, is syncing between my primary MacPro and my travel laptop. Your mileage may vary.

But wait! There’s more! This trick works with anything and any app, not just database files and MySQL. Give it a try. It’s yet another reason DropBox is one of the greatest services available on the Net today.

Sphere: Related Content

Is DropBox the Free Replacement to MobileMe We’ve Been Waiting For?

Tuesday, September 8th, 2009

Dropbox [link] is a highly recommended service that lets you share large files amongst different groups and machines that I’ve written about before [here].  MobileMe is a very not-free service that provides marginal utility for Mac users.

If you’re like me, the only reason to use MobileMe on a daily basis is to keep my machines in sync.  So if there was a technique to use DropBox rather than MobileMe to handle all that syncing of data, wouldn’t we all just drop MobileMe in a heartbeat?  I know I would.

Well, so far, I’ve managed to replace the syncing for my third-party apps with sym linking, terminal, and DropBox.  I won’t go into detail here.  Instead, I’ll refer you to a very excellent walkthroughхотелско обзавеждане of the technique provided by the makers of TextExpander over at SmileOnMyMac. Link to the story here.

You’ll want to signup and download DropBox for free if you haven’t already done so.

Now, if we can figure out how to sync first-party apps, we can finally kick MobileMe to the curb and spend that $100 a year on something better.

Sphere: Related Content