I’ve been coming around lately to the local development environment vs doing all of my development on a remote server. The last thing I moved onto my laptop was MySQL and I am used the popular (and free) tool MAMP to get it running quickly.
However, as I am a fan of the MySQL command-line client, I went to test my installation by running:
I expected a connection to the server running on localhost. What I got was an error:
It turns out that MAMP sets up its unix socket in
/Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock rather than in
/tmp/mysql.sock (where the MySQL command line client looks for it. Rather than passing in a messy
--socket option to mysql, I opted for the following, which did the trick: