Cdbconnection Failed :: Can't Connect To Localmysql Server Through Socket

Hello Yii Friends,

I am getting a exception message in live server but I don’t have any problem in my local machine. Such exception message generate randomly and I am not sure what is the reason for this.I tried other solution but it does not work out. It throw such exception message:-

[color="#FF0000"]CDbConnection failed to open the DB connection : SQLstate[HY000][2002] Can’t connect to local mysql server through socket '/var/run/mysqld/mysqld.sock (111).[/color]

If anyone have find out this problem solution or have idea redarding this problem. Please let me know.

Thanks in Advance


Just ran into this too. Trying to move from a local evn. to a production one.

Hello waterloomatt

yes, I am having the same problem. Do you have any idea to sort out this problem. Because this is giving me lots problem in the Yii.As well as can you tell me what type of problem is this and how do we get it. If you found out any idea, Please do share with me.

Thank You



I haven’t resolved it yet. A system admin is installing the app so I don’t know all the details. I did some google’ing yesterday and many people are resolving the problem by replacing the ‘localhost’ portion on the connection string with ‘’ or the name of the server.



Thank you for your information. Anyway if you are able to solve this problem. Please let me know as well as I am trying too to figure out this problem.