Whilst I’ve become a huge fan of running Valet for local development – specifically Magento 2 which runs at a pace that doesn’t make me want to claw my eyes out – rather than installing Apache / Nginx, configuring, adding entries in the hosts file etc, I have found it trip me up a few times.
A key one of these, is Valet may show firstname.lastname@example.org to be running, but when you try connecting with:
mysql -u root -p
You may well get the following error (as I have done numerous times):
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock'
If you do get this, then run the following:
brew services restart email@example.com
And you’ll find yourself back in business.