3

I am a newbie programmer, so I will need your help! Locally the webapp works ok with the db on it! When I uploaded the application on the cloudcontrol, it comes up with the following error:

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

I suppose I have not uploaded the db. This is the very first time I upload a webapp on a server so I do not know the exact steps that I have to follow in order to upload the db on a server. Cloudcontrol has documentation about mysql! I did follow the steps but the webapp comes with the same error!

Could you please tell me what steps I have to follow in order to make it working? I am sure that this error is due to lack of knowledge!

Kijewski
  • 25,517
  • 12
  • 101
  • 143
Fotis
  • 51
  • 1
  • 1
  • 2
  • Did you start the server ? is the server located on your development machine ? – daisy May 23 '12 at 12:35
  • the server runs! like i said locally the site works fine! the error comes up when i uploaded on the cloudcontrol! – Fotis May 23 '12 at 12:39
  • This question is not about programming, but more about system administartion. Still, that error message often appears because your socket is at another location. Fix your MySQL (config file) to put the socket where your application wants it, fix your application to check the socket where your MySQL puts it, or create a symlink where the application wants it, pointing to where MySQL puts it. – Konerak May 23 '12 at 12:39

2 Answers2

4

Most likely the SQL server resides on a separate machine which you need to address via a host name or IP.

This means that in your code you should replace localhost with the hostname of the machine where the SQL server resides (ex.: mysql.s032.example.com).

Finding the address of the SQL machine should be easy enough if it's documented by the hosting company within their control panel. Or by asking the hosting providers' tech support to tell you the address.

Mihai Stancu
  • 15,848
  • 2
  • 33
  • 51
1

As a newbie, I think you havn't installed mysql-server and tried to install phpmyadmin.

Go to synaptic package => select mysql-server => automatically necessary componeents will be selected => Mark them for installation => apply

then, reinstall => phpmyadmin

Works fine.

If the above doent work, then, Follow this

Angelin Nadar
  • 8,944
  • 10
  • 43
  • 53