Could not connect to an external database

Hi:

Although i have configured an external database connection the same way i used to with cakePhp 2, it wasn’t possible to connect using the cakePhp 3.6. It keeps showing me the same error message:

CakePHP is NOT able to connect to the database.
Connection to database could not be established: SQLSTATE[HY000] [1045] Access denied for user ‘surfgurusql’@‘localhost’ (using password: YES)

The configuration in Config/app.php , however, is NOT pointing to localhost:

'Datasources' => [

    'surfguru' => [
        'className' => 'Cake\Database\Connection',
        'driver' => 'Cake\Database\Driver\Mysql',
        'persistent' => false,
        'host' => '#########.rds.amazonaws.com',
        'port' => '3306',
        'username' => 'surfgurusql',
        'password' => '########',
        'database' => '*****',
        'unix_socket' => '/opt/bitnami/mysql/tmp/mysql.sock',
        'encoding' => 'utf8',
        'timezone' => 'UTC',
        'flags' => [],
        'cacheMetadata' => false,
        'log' => true,
        'quoteIdentifiers' => false,
        'url' => env('###########.rds.amazonaws.com', null)
    ]

],

Does someone knows the answer?

Thanks,
Gabriel

Maybe try remove unix_socket ?

Also check if you enabled “external” user in your database.

Perfect!

It was the “unix_socket” variable!

As i told, i was already using the same database server with an old version of cakePhp, said that, there was no problem with the database server itself.

Thank you very much for the answer Jarekgol !

The correct form, that WORKS! is below: