热搜:NVER 

连接数据库的有关问题

2024-05-17 17:39:01
 连接数据库的有关问题

连接数据库的问题
请问出现这种错误怎么办?谢谢帮忙!
CDbException
描述
CDbConnection 无法开启数据库连线: SQLSTATE[28000] [1045] Access denied for user 'zs6411'@'localhost' (using password: YES)

源文件
E:\TopShare\htdocs\yii\framework\db\CDbConnection.php(255)

00243: {
00244: if(empty($this->connectionString))
00245: throw new CDbException(Yii::t('yii','CDbConnection.connectionString cannot be empty.'));
00246: try
00247: {
00248: Yii::trace('Opening DB connection','system.db.CDbConnection');
00249: $this->_pdo=$this->createPdoInstance();
00250: $this->initConnection($this->_pdo);
00251: $this->_active=true;
00252: }
00253: catch(PDOException $e)
00254: {
00255: throw new CDbException(Yii::t('yii','CDbConnection failed to open the DB connection: {error}',
00256: array('{error}'=>$e->getMessage())));
00257: }
00258: }
00259: }
00260: 
00261: /**
00262: * Closes the currently active DB connection.
00263: * It does nothing if the connection is already closed.
00264: */
00265: protected function close()
00266: {
00267: Yii::trace('Closing DB connection','system.db.CDbConnection');
堆栈追踪
#0 E:\TopShare\htdocs\yii\framework\db\CDbConnection.php(230): CDbConnection->open()
#1 E:\TopShare\htdocs\yii\framework\db\CDbConnection.php(209): CDbConnection->setActive(true)
#2 E:\TopShare\htdocs\yii\framework\base\CModule.php(353): CDbConnection->init()
#3 E:\TopShare\htdocs\yii\framework\base\CApplication.php(373): CModule->getComponent('db')
#4 E:\TopShare\htdocs\yii\framework\db\ar\CActiveRecord.php(876): CApplication->getDb()
#5 E:\TopShare\htdocs\yii\framework\db\ar\CActiveRecord.php(2242): CActiveRecord->getDbConnection()
#6 E:\TopShare\htdocs\yii\framework\db\ar\CActiveRecord.php(656): CActiveRecordMetaData->__construct(Object(public_user))
#7 E:\TopShare\htdocs\toplinker-web\protected\models\public_user.php(15): CActiveRecord::model('public_user')
#8 E:\TopShare\htdocs\toplinker-web\protected\components\UserIdentity.php(20): public_user::model()
#9 E:\TopShare\htdocs\toplinker-web\protected\models\LoginForm.php(48): UserIdentity->authenticate()
#10 E:\TopShare\htdocs\yii\framework\validators\CInlineValidator.php(39): LoginForm->authenticate('password', Array)
#11 E:\TopShare\htdocs\yii\framework\validators\CValidator.php(163): CInlineValidator->validateAttribute(Object(LoginForm), 'password')
#12 E:\TopShare\htdocs\yii\framework\base\CModel.php(187): CValidator->validate(Object(LoginForm), NULL)
#13 E:\TopShare\htdocs\toplinker-web\protected\controllers\SiteController.php(42): CModel->validate()
#14 E:\TopShare\htdocs\yii\framework\web\actions\CInlineAction.php(32): SiteController->actionLogin()
#15 E:\TopShare\htdocs\yii\framework\web\CController.php(300): CInlineAction->run()
#16 E:\TopShare\htdocs\yii\framework\web\CController.php(278): CController->runAction(Object(CInlineAction))
#17 E:\TopShare\htdocs\yii\framework\web\CController.php(257): CController->runActionWithFilters(Object(CInlineAction), Array)
#18 E:\TopShare\htdocs\yii\framework\web\CWebApplication.php(310): CController->run('login')
#19 E:\TopShare\htdocs\yii\framework\web\CWebApplication.php(120): CWebApplication->runController('site/login')
#20 E:\TopShare\htdocs\yii\framework\base\CApplication.php(135): CWebApplication->processRequest()
#21 E:\TopShare\htdocs\toplinker-web\index.php(11): CApplication->run()
#22 {main}2010-01-25 03:43:00 Apache/2.2.8 (Win32) DAV/2 mod_ssl/2.2.8 OpenSSL/0.9.8g mod_autoindex_color PHP/5.2.5 mod_perl/2.0.3 Perl/v5.8.8 Yii Framework/1.0.10

------解决方案--------------------