Connection refused on migrate

Hi, I hope you can help me.

When I run the migration, the first one, I get an error 'Exception ‘yii\db\Exception’ with message ‘SQLSTATE[HY000] [2002] Connection refused’

This is the command:


/Applications/MAMP/bin/php/php5.6.10/bin/php ./yii migrate --interactive=0

and this is the db config:


 'db' => [

        'class' => 'yii\db\Connection',

        'dsn' => 'mysql:host=127.0.0.1;port:8889;dbname=asc_auth;unix_socket=/Applications/MAMP/tmp/mysql/mysql.sock',

        'username' => 'myuser',

        'password' => 'mypassword',

        'charset' => 'utf8',

    ],

Same error without the unix_socket part.

I checked with another Yii2 template that the db connection is working with that string.

Thank you

Try ‘unix_socket=localhost:/Applications/MAMP/tmp/mysql/mysql.sock’

That worked for me.