修改protected/config/main.php
'db'=>array( 'connectionString' => 'mysql:host=localhost;dbname=test', 'emulatePrepare' => true, 'username' => 'root', 'password' => 'root', 'charset' => 'utf8', /* * 下面是调试信息,显示执行的数据库操作 */ 'enableProfiling'=>YII_DEBUG, 'enableParamLogging'=>YII_DEBUG, ),
'log'=>array(
'class'=>'CLogRouter',
'routes'=>array(
array(
'class'=>'CFileLogRoute',
'levels'=>'error, warning',
),
// uncomment the following to show log messages on web pages
array(
'class'=>'CWebLogRoute',
'levels'=>'trace',
'categories'=>'system.db.*',
),
),