Yii Framework Forum: Problem With Mysql Connection In Mamp - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Problem With Mysql Connection In Mamp CDbConnection failed to open the DB connection in MAMP installation Rate Topic: -----

#1 User is offline   fratoal 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 20-November 13

Posted 20 November 2013 - 11:30 AM

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!!
0

#2 User is offline   Jessé 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 25-June 13

Posted 20 November 2013 - 12:13 PM

Try using:

   'db'=>array(
        'connectionString' => 'mysql:host=localhost;dbname=testdrive;',
        'username' => 'root',
        'password' => '',
        'charset' => 'utf8',
        //'enableParamLogging'=>true,
        //'enableProfiling'=>true,
                ),

]
0

#3 User is offline   fratoal 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 20-November 13

Posted 23 November 2013 - 03:22 AM

View PostJessé, on 20 November 2013 - 12:13 PM, said:

Try using:

   'db'=>array(
        'connectionString' => 'mysql:host=localhost;dbname=testdrive;',
        'username' => 'root',
        'password' => '',
        'charset' => 'utf8',
        //'enableParamLogging'=>true,
        //'enableProfiling'=>true,
                ),

]


Thanks, but don't works :(
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users