0

Okay so i am trying to connect to my remote SQL database.

i am using the following settings:

public $default = array(
    'datasource' => 'Database/Mysql',
    'persistent' => false,
    'host' => '10.246.16.153:3306',
    'login' => '*******',
    'password' => '*******',
    'database' => 'udlejnings_pris',
    'prefix' => '',
    //'encoding' => 'utf8',
);

My Database settings are the following:

Database server
    Server: 10.246.16.153 via TCP/IP
    Software: MySQL
    Software version: 5.1.66-0+squeeze1 - (Debian)
    Protocol version: 10
    Server charset: UTF-8 Unicode (utf8)

Now when im trying to access this server i get the following error:

    2013-10-12 16:27:28 Error: [MissingConnectionException] Database connection "Mysql" is missing, or could not be created.
Exception Attributes: array (
  'class' => 'Mysql',
  'message' => 'SQLSTATE[HY000] [2002]
',
  'enabled' => true,
)

So what am i doing wrong?

Marc Rasmussen
  • 19,771
  • 79
  • 203
  • 364

2 Answers2

1

Many hosted MySQL instances don't allow clients to connect remotely by default. You may need to add your IP address into some form of Remote MySQL option if your database host provides it. For example, if the server with the database on it uses cPanel, there is a 'Remote MySQL' option on there which may resolve your issue. Alternatively, you could execute the 'GRANT' SQL command to allow your user account access remotely as described in this answer.

If you still have issues, a firewall may be blocking the connection locally too.

Community
  • 1
  • 1
Luke Briggs
  • 3,745
  • 1
  • 14
  • 26
1

Maybe you need to enable mysql remote access on the server that you are connecting to. By default it is disabled.

http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html

Maverick
  • 905
  • 8
  • 23