As I’m working with Symfony 2 with Doctrine as an ORM and using MySQL as a database.
I found this error when trying to create a database using the command “php app/console doctrine:database:create”.
I got “No such file or directory” error message.
After researched, I’ve found that my MAMP is missing one thing…
When Doctrine is trying to create a new database, it is finding a ‘/var/mysql/mysql.sock’ which never exists in my system after MAMP installed.
So, the solution is to create a symbolic link to where the actual mysql.sock stay with this command…
“sudo mkdir mysql”
“ln -s /Applications/MAMP/tmp/mysql/mysql.sock mysql.sock”
Then try to run “php app/console doctrine:database:create” again.
It will works!
If you are using Zend Server, you probably found the same error, just do the same but create a symbolic link to “/usr/local/zend/mysql/tmp/mysql.sock” instead of MAMP’s.