Osx/mamp Mysql Problem

I am trying to set up yii with MAMP on my macbook pro, but am running into errors when trying to run the "yiic migrate" command:

[indent]

Yii Migration Tool v1.0 (based on Yii v1.1.13)

PHP Error[2]: PDO::__construct(): [2002] No such file or directory (trying to connect via unix:///var/mysql/mysql.sock)

in file /Applications/MAMP/framework/db/CDbConnection.php at line 423

#0 /Applications/MAMP/framework/db/CDbConnection.php(423): PDO->__construct()

#1 /Applications/MAMP/framework/db/CDbConnection.php(373): CDbConnection->createPdoInstance()

#2 /Applications/MAMP/framework/db/CDbConnection.php(330): CDbConnection->open()

#3 /Applications/MAMP/framework/db/CDbConnection.php(308): CDbConnection->setActive()

#4 /Applications/MAMP/framework/base/CModule.php(387): CDbConnection->init()

[/indent]

The phpMyAdmin that came with MAMP is running correctly, and I can connect to the database from the command line (it’s in /Applications/MAMP/Library/bin/mysql). My connection info (this is from config/console.php, and main is the same):

            'db'=>array(


                    'connectionString' => 'mysql:port=8889;dbname=co_dev',


                    'emulatePrepare' => true,


                    'username' => <my database user is here>,


                    'password' => <my password is here>,


                    'charset' => 'utf8',


            ),

Any thoughts?

Thanks,

Andy

Is you front-end work correctly or you get the same error?

[size=2]First of all I’d check your DSN string, trying to set host to ‘127.0.0.1’ or ‘localhost’[/size]

Also there’re several solutions to this error you may find with a bit of googling,for example:

http://www.webbykat.com/2012/05/link/fixing-drush-error-pdoconstruct-2002-no-such-file-or-directory