Recently was working through a Symfony2 tutorial and ran into an issue. Tried performing a create database command and ran into an issue.
Create Database Command
php app/console doctrine:database:create
Could not create database for connection named nameofthedatabase
SQLSTATE[HY000]  No such file or directory
Using MAMP, I had to create a symbolic link to the the MAMP myslq socket.
sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock mysql.sock
Rerun the command and all should be good!
What is the mysql.sock?
“The mysql.sock is the socket that mysqld creates for programs to connect to.”