MAMP MySQL Command Line Access

I love MAMP for local development on Mac OS X – it gives you a quick LAMP-style development environment on your machine with zero hassle – and it’s free.

If you’re a user who also likes using MySQL on the command line to manage your local databases though, it might be a little confusing, because after installing MAMP you can’t do so. Just run this in terminal and you should be set:

sudo ln -s /Applications/MAMP/Library/bin/mysql /usr/local/bin/mysql

What this does is add a symbolic link for the mysql binary from MAMP into your executable path – in this case, within /usr/local/bin/

Incidentally, /Applications/MAMP/Library/bin/ is where you’ll also find all the other MySQL binaries, like mysqldump.

Warning: If you’ve installed MySQL manually as well, this may interfere with that installation, so don’t do this if you have!