Problem With Mysql Connection In Mamp

Hello,

I have a Yii project copy/pasted from another computer to my Mac with MAMP installation. I copied the previous folder structure and i config the vhosts and etc/hosts to work with my new local domain.

Everything works fine but when the app try to connect with MySQL prompt this message in the browser:

Error 500

CDbConnection failed to open the DB connection.

I found some solutions in this forums. Actually i change my PHP installation. When I put "Which PHP" in my console I get this result:

/Applications/MAMP/bin/php/php5.4.10/bin/php

In my Main.php I have this configuration:


'db'=>array(

	'connectionString' => 'mysql:host=localhost;dbname=testdrive;unix_socket=/Applications/MAMP/tmp/mysql/mysql.sock',

	'emulatePrepare' => true,

	'username' => 'root',

	'password' => 'root',

	'charset' => 'utf8',

	//'enableParamLogging'=>true,

	//'enableProfiling'=>true,

		),

I’ve tried other “connectionString” options, change localhost by 127.0.0.1, without socket info, adding port:8805, etc…

It seems that SQLITE works but i need to work with MYSQL.

But I can’t achieve that it works :(

Can anyone help me?

Thanks!!

Try using:




   'db'=>array(

        'connectionString' => 'mysql:host=localhost;dbname=testdrive;',

        'username' => 'root',

        'password' => '',

        'charset' => 'utf8',

        //'enableParamLogging'=>true,

        //'enableProfiling'=>true,

                ),



]

Thanks, but don’t works :(