CakePHP Console under MAMP

So if you are running MAMP on your Mac and baking some CakePHP you may encounter errors when trying to run the Cake Console.

The error is likely to look something like

Warning Error: PDO::__construct(): [2002] No such file or directory (trying to connect via unix:///var/mysql/mysql.sock) in [/rootpath/lib/Cake/Model/Datasource/Database/Mysql.php, line 160]

Add the following to your database.php config file.

'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock'

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.