Database connection error

CDbConnection failed to open the DB connection: SQLSTATE[28000] [1045] Access denied for user ‘root’@‘localhost’ (using password: NO)

Any ideas anyone?

Its ok now!

how do you solve it?? can you explain it?

I believe James just fixed his db connection parameters in the configuration file.

Just find this post and want to contribute something for those who are new to Yii framework like me.

1.) Modified the db config file (located at your-root-folder\protected\config\main.php)

eg.

array(

......


'components'=>array(


    ......


    'db'=>array(


        'class'=>'CDbConnection',


        'connectionString'=>'mysql:host=localhost;dbname=[color="#FF0000"]YOUR-DATABASE-NAME[/color]',


        'username'=>'[color="#FF0000"]YOUR-DATABASE-USER-NAME[/color]',


        'password'=>'[color="#FF0000"]YOUR-DATABASE-PASSWORD[/color]',


        'emulatePrepare'=>true,  // needed by some MySQL installations


    ),


),

)

2.)Restart your web server (might be optional)

3.)Test again (it should work by now)