Blog → Configuring terminal to work with MAMP mysql on Leopard
I've decided to try MAMP on new Mac OS X 10.5. Mostly because PHP bundled with Leopard doesn't have GD library (otherwise it has quite cool set of modules). The other reason that is better Marc Liyanage's PHP installer is not yet ready for Leopard.
But after backing up all my MySQL databases (around 200Mb dump) it turned out that you can't acces MAMP's mysql via terminal to restore it (or I was something terribly missing from FAQs).
Here is a hint. You have to create symlink from local mysql.sock to MAMP:
sudo mkdir /var/mysql
sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /var/mysql/mysql.sock
sudo chown _mysql /var/mysql/mysql.sock
sudo chmod 777 /var/mysql/mysql.sock
Hope it'll save somebody's few minutes.
UPD #1: Just in sake of more comfort you can add MAMP's mysql to bash profile (don't forget to reopen terminal window to let it work):
echo 'export PATH=/Applications/MAMP/Library/bin:$PATH' >> ~/.bash_profile
UPD #2: This hint works on Snow Leopard (10.6) just fine.