本文介绍了在Yii框架中配置数据库连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Yii框架的main.php文件中,有一些配置选项.这是它设置mysql的方式
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',
),
在MAMP系统上,我必须将端口指定为8889.如何将其添加到其中?
On my MAMP system, I have to specify the port as 8889. How would I add it into this?
谢谢
推荐答案
我添加了这样的端口,它似乎可以工作
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',
),
这篇关于在Yii框架中配置数据库连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!