Question

I have an app that I uploaded to www.cloudcontrol.com. PHP app. I have mysql addon and have a running database with data already setup. I can access the database from my localhost using my app without any errors, when I try and access via the app uploaded to cloudcontrol, I get 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)

If anyone could please help me with this. Thanks.

Était-ce utile?

La solution

On the cloudControl platform databases run on separate machines. All the credentials are provided as part of the run-time environment. This includes also host and port. You can not connect via socket. Please refer to the documentation on how to read the credentials from there.

https://www.cloudcontrol.com/dev-center/Platform%20Documentation#add-on-credentials

Autres conseils

Try to remove host & DB_HOST info and use unix_socket.

Something like this:

'db'=>array(
        'username' => DB_USER,
        'password' => DB_PASS,
        'connectionString' => 'mysql:unix_socket=' . DB_SOCK . ';dbname=' . DB_NAME,
        'emulatePrepare' => true,
        'charset' => 'utf8',
        'tablePrefix' => 'tbl_',
        'enableProfiling' =>false,
        'enableParamLogging'=>false
),
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top