I try to use the migration tool, but I get the following error:
exception 'CDbException' with message 'CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002] Connection refused' in /Applications/MAMP/htdocs/yii-sandbox/framework/db/CDbConnection.php:382 Stack trace:
I checked the database settings in console.php
, which look like this:
'db'=>array( 'connectionString' => 'mysql:host=127.0.0.1;dbname=yii_trackstar, unix_socket=/Applications/MAMP/tmp/mysql/mysql.sock', 'emulatePrepare' => true, 'username' => 'yii', 'password' => 'xxx', 'charset' => 'utf8', ),
As you can see, I tried to set the host to 127.0.0.1 and install the unix socket according to other suggestions.
I am using MAMP (as you can see). from the protected directory I execute the command: ./yiic migrate
No matter what I change, I get the same error message.
* Update: *
I just got it. Changing host=localhost
to host=127.0.0.1
actually gives me another connection refused
error. If I go back to localhost
, the error will be the following:
exception 'CDbException' with message 'CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002] No such file or directory' in /Applications/MAMP/htdocs/yii-sandbox/framework/db/CDbConnection.php:382
source share