Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

configuring database connection in Yii framework

Tags:

php

mysql

yii

In the main.php file of the Yii framework, there are some configuration options. This is how it sets up mysql

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

On my MAMP system, I have to specify the port as 8889. How would I add it into this?

thanks

like image 207
Leahcim Avatar asked May 25 '11 08:05

Leahcim


2 Answers

I added the port like this and it seems to work

'db'=>array(
            'connectionString' => 'mysql:host=localhost;port=8889;dbname=testdrive',
            'emulatePrepare' => true,
            'username' => 'root',
            'password' => 'root',
            'charset' => 'utf8',
        ),
like image 120
Leahcim Avatar answered Sep 30 '22 08:09

Leahcim


can you not add it here to your connectionString

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

like image 35
martynthewolf Avatar answered Sep 30 '22 10:09

martynthewolf