3

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.

moraisandre
  • 117
  • 8

2 Answers2

0

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

pst
  • 1,414
  • 11
  • 22
-2

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
),
Timvp
  • 3,681
  • 1
  • 14
  • 15
  • It seems like using the unix_socket is exactly the problem. Adding host & DB_HOST as stated in the addon credentials can solve the problem. – TooAngel Apr 08 '14 at 12:23