Cdbconnection Failed To Open The Db Connection

Hi,

Im having a trouble after uploading my app to a server. In my local server every thing goes OK, I have complete my work and the site is working well.

When I’ve uploaded to the web server, I changed the settings database and always appears the following error:

CDbConnection failed to open the DB connection: SQLSTATE [HY000] [2002] Can not connect to local MySQL server through socket ‘/ var / run / mysqld / mysqld.sock’ (2)

I test the connection to the database via a link normal PHP:


$ link = mysql_connect ('MySQLServer', 'user', 'pass');

And it works, so I know the parameters are right.

What could I’m possible doing wrong?

Thanks

Have you verified the requirements on the Web server? http://www.yiiframework.com/doc/guide/1.1/en/quickstart.installation#requirements

Have you tried this? http://www.yiiframework.com/forum/index.php/topic/6554-database-connection-issue/page__p__33536#entry33536

You can also see this QA, maybe it’ll help? http://stackoverflow.com/questions/2138959/confusing-pdo-only-problem-cant-connect-through-socket-access-denied-cant-co

hi you can specify the mysql socket path manualy

since mysql uses /tmp/mysql.sock by default should fix it