arfname
arfname

Reputation: 379

yiic: CDbConnection failed to open the DB connection

My DB connection works perfectly in web application. But when I try the same settings in console application it fails (I wrote connection settings in console.php file).

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?

Upvotes: 1

Views: 1020

Answers (2)

Krupal Solanki
Krupal Solanki

Reputation: 36

if you want to connect to the same DB which you connect to in your web application then copy your 'db' => array(...) in config/main.php to config/console.php

Upvotes: 0

Chalist
Chalist

Reputation: 3309

In console.php change localhost to 127.0.0.1

Upvotes: 0

Related Questions