2013-12-10 54 views
-1

我已经安装了包含mysql的xampp。我可以在yii框架中使用这个mysql吗? 如果是的我怎么能用phpmyadmin来做到这一点。请帮助。是新手..我可以在yii框架中使用mysql吗?

我已经看到了使用SQLite在很多教程警予很多人..

+0

请先做一些基础研究。 –

+0

http://indev.org.ua/download/Larry_Ullman_The_Yii_Book_2013_www.indev.org.ua.pdf请参阅 – user3526905

回答

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_', 
    ), 

这一切!

+0

非常感谢。你能告诉我如何显示数据库内容到一个页面..?例如在index.php ... –

+0

http://www.larryullman.com/2009/11/05/creating-models-views-and-controllers-in-yii/这些链接帮助你 – anu

+0

我认为你需要研究更多,也许读一本关于Yii的书,这些都在那里很好地解释。 – tinybyte

相关问题