CakePHP on OSX: Problem using Bake.php script

If you are getting the following errors while trying to bake something on osx 10.4:

"Warning: mysql_connect(): Can't connect to local MySQL server through
socket '/var/mysql/mysql.sock' (2) in /Library/WebServer/Documents/development/bakery/cake/libs/model/dbo/dbo_mysql.php
on line 117" 

try doing the following:

sudo ln -s /tmp /var/mysql

Or you could follow the instruction given by Apple: Mac OS X Server 10.4: Issues connecting PHP to MySQL