我安装了xampp,其中包含mysql。我可以在yii框架中使用这个mysql吗? 如果是,我怎么能用phpmyadmin做到这一点。请帮忙。我是新手......
我见过许多人在许多教程中使用sqlite和yii ..
答案 0 :(得分:1)
好的,您需要做的就是打开/protected/config/main.php
,然后查找如下所示的行:
),
'db'=>array( // as you can see this db is currently in use
'connectionString' => 'sqlite:protected/data/blog.db',
'tablePrefix' => 'tbl_',
),
// uncomment the following to use a MySQL database
/*
'db'=>array(
'connectionString' => 'mysql:host=localhost;dbname=blog',
'emulatePrepare' => true,
'username' => 'root',
'password' => '',
'charset' => 'utf8',
'tablePrefix' => 'tbl_',
),
*/
只是注释第一个连接到sqlite数据库并取消注释使用mysql数据库的第二部分:
),
/*'db'=>array(
'connectionString' => 'sqlite:protected/data/blog.db',
'tablePrefix' => 'tbl_',
),*/
// uncomment the following to use a MySQL database
'db'=>array(
'connectionString' => 'mysql:host=localhost;dbname=blog',
'emulatePrepare' => true,
'username' => 'root',
'password' => '',
'charset' => 'utf8',
'tablePrefix' => 'tbl_',
),
就是这样!