>  기사  >  데이터 베이스  >  Yii中使用gii连接数据库报错CDbConnection failed to open the D

Yii中使用gii连接数据库报错CDbConnection failed to open the D

WBOY
WBOY원래의
2016-06-07 15:49:251703검색

在使用 http://www.larryullman.com/2009/11/07/creating-models-views-and-controllers-in-yii-2/ 教程时,遇到如题目描述的问题,本来准备在文章下面评论做笔记的,发现“连接被重置”,开代理去评论,发现代理IP在blacklist上,于是只好写在这里 And now

在使用

http://www.larryullman.com/2009/11/07/creating-models-views-and-controllers-in-yii-2/

教程时,遇到如题目描述的问题,本来准备在文章下面评论做笔记的,发现“连接被重置”,开代理去评论,发现代理IP在blacklist上,于是只好写在这里


And now I want to record some problem I met when I learn, and also I will offer my solusion.
When I created the database My_manage_01, and then went to the http://localhost/yiitestapp/index.php/gii to click the Model Generator, it turn to be wrong, and it says like this:

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

After suffering for one night, I finally find the answer. It's in the C:\xampp\htdocs\yiitestapp\protected\config\main.php, line 55. You need to add the database you created manually and so as the code.

Then everthing is OK.
성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.