CDbConnection failed to open the DB connection


in my yii website the mysql connection is working in localhost…

after hosting i got a error like this

CDbConnection failed to open the DB connection: SQLSTATE[00000] [1130] Host ‘MyHost’ is not allowed to connect to this MySQL server

can you give any suggestions…?


your mysql server is still set to "myhost" change that

Use your mysql database server ip…

like this -


			'connectionString' => 'mysql:host=115.121.XXX.XXX'; dbname=your_db_name',

			'emulatePrepare' => true,

			'username' => 'db_user_name',

			'password' => 'db_password',

			'charset' => 'utf8',



yes im use the ip like ""

but still the error…

Sound like PRIVILEGES Issue, if your domain having same is then use ‘LOCALHOST’ instead of IP.

if the ip is not working try "localhost" instead

correct…thanks…its working

your correct…i changed as "localhost" instead of ""

thanx for reply…