Unable to connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

I'm a beginner programmer, so I need your help! Locally webapp works fine with db on it! When I downloaded the application to cloud control, it causes the following error:

CDbConnection could not open the database connection: SQLSTATE [HY000] [2002] Cannot connect to the local MySQL server through the socket '/var/run/mysqld/mysqld.sock' (2)!

I suppose I did not load db. This is the first time that I load webapp on the server, so I don’t know which steps I have to follow to load db on the server. Cloudcontrol has mysql documentation! I followed the steps below, but webapp comes up with the same error!

Could you tell me what steps I must follow to make it work? I am sure that this error is due to a lack of knowledge!

+3
source share
2 answers

Most likely, the SQL server is located on a separate machine, which you need to address through the host name or IP address.

This means that in the code you must replace localhostwith the name of the computer on which the SQL server is located (for example:) mysql.s032.example.com.

Finding the address of the SQL machine should be quite simple if it is documented by the hosting company within the control panel. Or ask the technical support of the hosting providers to tell you the address.

+4
source

, , mysql- phpmyadmin.

= > mysql-server = > = > = >

= > phpmyadmin

.

,

+1

All Articles