문제

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.

도움이 되었습니까?

해결책

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

다른 팁

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
),
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top