0

I can't connect my cakephp application with mysql database. when I run it in localhost it works but when I move to a remote server it doesn't and it gives this error:

Missing Database Connection

I tried these solutions but it was vain in all cases:

  • Commented out : skip-networking.
  • edited the LocationMatch bloc in the htppd-xamp.conf yet still no changes

Below is the code of the connection to the DB:

<?php
class DATABASE_CONFIG {

    public $default = array(
        'datasource' => 'Database/Mysql',
        'persistent' => false,
        'host' => '51.254.205.243',
        'login' => 'login',
        'password' => 'pwd',
        'database' => 'db',
        'prefix' => '',
        'encoding' => 'utf-8'
    );
}

If you really know what is going on and how to fix this issue, I would be grateful to learn from you.

Regards

zakaria mouqcit
  • 393
  • 2
  • 4
  • 17
  • Possible duplicate: https://stackoverflow.com/questions/19280245/cakephp-database-connection-mysql-is-missing-or-could-not-be-created – DPS Oct 22 '18 at 10:25
  • I'm in a remote server and when I use 127.0.0.1 instead of 51.254.205.243 it works. This what I can't understand because postgresql is working with 51.254.205.243 and mysql is not – zakaria mouqcit Oct 22 '18 at 10:36

1 Answers1

0

Change host to 127.0.0.1 / localhost

P.Banerjee
  • 189
  • 2
  • 14