Yii中使用gii连接数据库报错CDbConnection failed to open the DB connection: SQLSTATE[HY000] [1045] Access denied

在使用

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.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 5
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值