[英]yiic: CDbConnection failed to open the DB connection
My DB connection works perfectly in web application. 我的数据库连接可以在Web应用程序中完美运行。 But when I try the same settings in console application it fails (I wrote connection settings in console.php file). 但是,当我在控制台应用程序中尝试相同的设置时,它会失败(我在console.php文件中写入了连接设置)。
CDbConnection failed to open the DB connection: SQLSTATE[28000] [1045] Access denied for user 'username'@'host' (using password: YES)
I can't solve problem for 4 hours. 我四个小时不能解决问题。 What might be wrong? 可能是什么问题?
在console.php中将localhost
更改为127.0.0.1
如果要连接到在Web应用程序中连接的同一数据库,则将config / main.php中的'db' => array(...)
复制到config / console.php
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.