在Yii框架中配置数据库连接

问题描述

| 在Yii框架的main.PHP文件中,有一些配置选项。这是如何设置MysqL
\'db\'=>array(
            \'connectionString\' => \'MysqL:host=localhost;dbname=testdrive\',\'emulatePrepare\' => true,\'username\' => \'root\',\'password\' => \'root\',\'charset\' => \'utf8\',),
在我的MAMP系统上,我必须将端口指定为8889。如何将其添加到其中? 谢谢     

解决方法

我添加了这样的端口,它似乎可以工作
\'db\'=>array(
            \'connectionString\' => \'mysql:host=localhost;port=8889;dbname=testdrive\',\'emulatePrepare\' => true,\'username\' => \'root\',\'password\' => \'root\',\'charset\' => \'utf8\',),
    ,不能在这里将其添加到connectionString吗
\'connectionString\' => \'mysql:host=localhost;dbname=testdrive;port=8889\',