在 Yii 框架中配置数据库连接 [英] configuring database connection in Yii framework

查看:24
本文介绍了在 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 框架中配置数据库连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆