Hello,
I'm having trouble connecting to a remote mysql DB. I'm using a RDS instance in Amazon for this connection. I believe the issue is that my "host" config is not being recognized and the connection resets to the default "localhost". That's why I'm getting the error "SQLSTATE[HY000] [1045] Access denied for user 'username'@'server_ip (using password: YES)"
where server_ip is the ip of the application server.
For my connection I'm using this piece of code in my public/index.php
$di->setShared('db', function () {
return new \Phalcon\Db\Adapter\Pdo\Mysql(array(
"host" => $this->get("config")->database->host,
"username" => $this->get("config")->database->username,
"password" => $this->get("config")->database->password,
"dbname" => $this->get("config")->database->dbname,
"port" => $this->get("config")->database->port,
"options" => [
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING,
PDO::ATTR_CASE => PDO::CASE_LOWER
]
));
});
The connection to the db works because I tested it using PDO directly so it's obviously a problem with my Phalcon connection. I'm using the Ini adapter for the config and I've removed all leading spaces before the "=" operator.
Thanks in advance.