I just launched a new course on ES6! Use the code WESBOS for $10 off.

Strengthen your core JavaScript skills and master all that ES6 has to offer. Start Now →

Dropbox your MAMP MySQL Databases

Apr 04 2011

I’m a backup fanatic and not having a few backups of files makes me uneasy. Today I had a little scare where I couldn’t find a few of my databases when viewing PHPmyAdmin through MAMP. Turns out sometimes MAMP likes to sometimes grab the databases from the MAMP Pro location and sometimes the MAMP location.

So, I decided it was time to figure out how to automatically backup my databases. The problem is that my MySQL databases are not in the same folder as my Dropbox folder.

The answer to this is very simple! First, if you haven’t already, sign up for dropbox. Then we just need to create a simple symlink that will allow the databases to be stored in their location and still be backed up to the DropBox folder.

First, figure out where MAMP stores your databases. If you are on good old MAMP, they will be located at /Applications/MAMP/db/ and if you are on MAMP Pro, they are located at /Library/Application Support/appsolute/MAMP PRO/db/mysql/

Next, pop open terminal so we can create our symlink. We will be using the link folders command (ln) and the -s argument to specify that its a symbolic link.

ln -s  /Applications/MAMP/db/ ~/Dropbox/symlinks/db

If your dropbox folder is different, make sure to change the last argument. Other than that, you’re setup. No more database loss nightmares!

This entry was posted in Other and tagged , , . Bookmark the permalink.

9 Responses to Dropbox your MAMP MySQL Databases

  1. David Lockie says:

    Nice tip.

    I use: http://www.swordsky.com/ AutoBackupMySQL to achieve something similar. It goes through my MySQL every day, and dumps all databases (automatically finding new ones) to GZIPs in a Dropboxed directory. Been a lifesaver so far – I use the same principle on my live VPS, but use JungleDisk server management for cloud backup instead there.

  2. Rachel Baker says:

    I have been using AutoMySQLBackup to output backups to my Dropbox folder, but your solution is pretty awesome – and useful for having to restore in-between a backup interval. Thank you for sharing. Love the new site.

  3. ralph says:

    Hi
    I used to do the same thing but now i’ve upgraded to MAMP 2.0 it doesn’t seem to work anymore.
    Are you experiencing the same thing?

  4. MAMP PRO 2.0 saves the databases here:
    /Library/Application Support/appsolute/MAMP PRO

    Maybe it’s the same with the non pro version.

  5. Bronius says:

    Re. symlinking to mamp/mysql db folders for copy to DropBox: Have you never run into issues from partial syncs at another computer?

    Currently rethinking my dev env backup and recovery strategy, I’m more inclined to look into a db dumper like the one mentioned above… experiences?

  6. Pingback: MAMP (love) Dropbox | jaimeteran.com

  7. Mihai says:

    Hi wesbos. I am trying for some time to find a solution on how to back up to dropbox the MAMP mysql db’s on my MAC. I saw your post, tried it with MAMP 2.0.2 (not PRO) and it does not work.
    Have you had the chance to upgrade from MAMP 1.9 to MAMP 2.0?
    Thanks!

  8. Peter says:

    I just tried it (MAMP PRO 2.1.1) and it works like a charm.
    I set it up so I can work on the same website from the office-desktop computer and my laptop.
    You just need to make sure that you’re not running MAMP on the syncing computers simulteanously, since you will have conflicting files and your db will run out of sync. Kind of obvious…

Leave a Reply

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