I initially used a local mysql database for my cakephp 3 application and everything was working as it should. I'm in the process of deploying my cakephp3 application so I created a RDS MySql instance and coected it to MySql workbench and just copied the database I had before to the RDS database. My settings in my app.php are like so.
To define my constants I have
if (!defined('RDS_HOSTNAME')) {
define('RDS_HOSTNAME', $_SERVER['myendpoint.us-west-1.rds.amazonaws.com']);
define('RDS_USERNAME', $_SERVER['myuseame']);
define('RDS_PASSWORD', $_SERVER['mypassword']);
define('RDS_DB_NAME', $_SERVER['my_db']);
}
Then in the datasources section of the app.php file
'Datasources' => [
'default' => [
'className' => 'CakeDatabaseCoection',
'driver' => 'CakeDatabaseDriverMysql',
'persistent' => false,
'host' => RDS_HOSTNAME,
/**
* CakePHP will use the default DB port based on the driver selected
* MySQL on MAMP uses port 8889, MAMP users will want to uncomment
* the following line and set the port accordingly
*/
//'port' => 'non_standard_port_number',
'useame' => RDS_USERNAME,
'password' => RDS_PASSWORD,
'database' => RDS_DB_NAME,
'encoding' => 'utf8',
'timezone' => 'UTC',
'flags' => [],
'cacheMetadata' => true,
'log' => false,
On the AWS Console it says that I have a coection to the RDS instance. However, when I try to register/login I get a CakePHP inteal error has occurred. I then checked the error logs and I found this in my error.log file.
2016-06-20 17:25:35 Error: [PDOException] SQLSTATE[HY000] [1045] Access denied for user ''@'localhost' (using password: NO)
Request URL: /users/register
Referer URL: http://localhost:8765/
Client IP: 127.0.0.1
Stack Trace:
#0 /home/danielparkk/Desktop/SubReminder/vendor/cakephp/cakephp/src/Database/Driver/PDODriverTrait.php(47): PDO->__construct('mysql:host=;por...', NULL, NULL, Array)
#1 /home/danielparkk/Desktop/SubReminder/vendor/cakephp/cakephp/src/Database/Driver/Mysql.php(90): CakeDatabaseDriverMysql->_coect('mysql:host=;por...', Array)
I don't understand what I'm doing wrong? When I switch back to the local copy of the database I have, everything functions as should. Any help would be appreciated.
