Home Backend Development PHP Tutorial 连接数据库的有关问题

连接数据库的有关问题

Jun 13, 2016 pm 01:52 PM
framework yii

连接数据库的问题
请问出现这种错误怎么办?谢谢帮忙!
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

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

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Microsoft NET Framework Installation Issues Error Code 0x800c0006 Fix Microsoft NET Framework Installation Issues Error Code 0x800c0006 Fix May 05, 2023 pm 04:01 PM

.NET Framework 4 is required by developers and end users to run the latest versions of applications on Windows. However, while downloading and installing .NET Framework 4, many users complained that the installer stopped midway, displaying the following error message - " .NET Framework 4 has not been installed because Download failed with error code 0x800c0006 ". If you are also experiencing it while installing .NETFramework4 on your device then you are at the right place

How to identify Windows upgrade issues using SetupDiag on Windows 11/10 How to identify Windows upgrade issues using SetupDiag on Windows 11/10 Apr 17, 2023 am 10:07 AM

Whenever your Windows 11 or Windows 10 PC has an upgrade or update issue, you will usually see an error code indicating the actual reason behind the failure. However, sometimes confusion can arise when an upgrade or update fails without an error code being displayed. With handy error codes, you know exactly where the problem is so you can try to fix it. But since no error code appears, it becomes challenging to identify the issue and resolve it. This will take up a lot of your time to simply find out the reason behind the error. In this case, you can try using a dedicated tool called SetupDiag provided by Microsoft that helps you easily identify the real reason behind the error.

SCNotification has stopped working [5 steps to fix it] SCNotification has stopped working [5 steps to fix it] May 17, 2023 pm 09:35 PM

As a Windows user, you are likely to encounter SCNotification has stopped working error every time you start your computer. SCNotification.exe is a Microsoft system notification file that crashes every time you start your PC due to permission errors and network failures. This error is also known by its problematic event name. So you might not see this as SCNotification having stopped working, but as bug clr20r3. In this article, we will explore all the steps you need to take to fix SCNotification has stopped working so that it doesn’t bother you again. What is SCNotification.e

Microsoft .NET Framework 4.5.2, 4.6, and 4.6.1 will end support in April 2022 Microsoft .NET Framework 4.5.2, 4.6, and 4.6.1 will end support in April 2022 Apr 17, 2023 pm 02:25 PM

Microsoft Windows users who have installed Microsoft.NET version 4.5.2, 4.6, or 4.6.1 must install a newer version of the Microsoft Framework if they want Microsoft to support the framework through future product updates. According to Microsoft, all three frameworks will cease support on April 26, 2022. After the support date ends, the product will not receive "security fixes or technical support." Most home devices are kept up to date through Windows updates. These devices already have newer versions of frameworks installed, such as .NET Framework 4.8. Devices that are not updating automatically may

KB5012643 for Windows 11 breaks .NET Framework 3.5 apps KB5012643 for Windows 11 breaks .NET Framework 3.5 apps May 09, 2023 pm 01:07 PM

It's been a week since we talked about the new safe mode bug affecting users who installed KB5012643 for Windows 11. This pesky issue didn't appear on the list of known issues Microsoft posted on launch day, thus catching everyone by surprise. Well, just when you thought things couldn't get any worse, Microsoft drops another bomb for users who have installed this cumulative update. Windows 11 Build 22000.652 causes more problems So the tech company is warning Windows 11 users that they may experience problems launching and using some .NET Framework 3.5 applications. Sound familiar? But please don't be surprised

How to use PHP framework Yii to develop a highly available cloud backup system How to use PHP framework Yii to develop a highly available cloud backup system Jun 27, 2023 am 09:04 AM

With the continuous development of cloud computing technology, data backup has become something that every enterprise must do. In this context, it is particularly important to develop a highly available cloud backup system. The PHP framework Yii is a powerful framework that can help developers quickly build high-performance web applications. The following will introduce how to use the Yii framework to develop a highly available cloud backup system. Designing the database model In the Yii framework, the database model is a very important part. Because the data backup system requires a lot of tables and relationships

Symfony vs Yii2: Which framework is better for developing large-scale web applications? Symfony vs Yii2: Which framework is better for developing large-scale web applications? Jun 19, 2023 am 10:57 AM

As the demand for web applications continues to grow, developers have more and more choices in choosing development frameworks. Symfony and Yii2 are two popular PHP frameworks. They both have powerful functions and performance, but when faced with the need to develop large-scale web applications, which framework is more suitable? Next we will conduct a comparative analysis of Symphony and Yii2 to help you make a better choice. Basic Overview Symphony is an open source web application framework written in PHP and is built on

Data query in Yii framework: access data efficiently Data query in Yii framework: access data efficiently Jun 21, 2023 am 11:22 AM

The Yii framework is an open source PHP Web application framework that provides numerous tools and components to simplify the process of Web application development, of which data query is one of the important components. In the Yii framework, we can use SQL-like syntax to access the database to query and manipulate data efficiently. The query builder of the Yii framework mainly includes the following types: ActiveRecord query, QueryBuilder query, command query and original SQL query

See all articles