Marc
Marc

Reputation: 493

CakePHP connect to remote database

i am trying to connect to a remote database using the following code:

public $default = array(
    'datasource' => 'Database/Mysql',
    'persistent' => false,
    'host' => '***.unoeuro-****.com',
    'login' => '*********',
    'password' => '**************',
    'database' => '************',
    'prefix' => '',
);

Now when i try this i get the following error message:

    2013-09-13 16:10:55 Error: [MissingConnectionException] Database connection "Mysql" is missing, or could not be created.
Exception Attributes: array (
  'class' => 'Mysql',
  'message' => 'SQLSTATE[HY000] [2005] Unknown MySQL server host \'****.unoeuro-server.com\' (2)',
  'enabled' => true,
)

Can anyone tell me why this is happening?

Upvotes: 1

Views: 3090

Answers (2)

Danson Mwangi
Danson Mwangi

Reputation: 61

If You are connecting to a remote Database from local host, you need to enable remote MySQL from the server you are trying to connect to. Its a security feature

Upvotes: 0

Jeyasithar
Jeyasithar

Reputation: 535

Since your database server is external resource, make sure you do not have firewall blocking the request from your application.

Upvotes: 2

Related Questions