Leder
Leder

Reputation: 392

Error connecting Rails 5 app database.yml to AWS RDS instance

I already set up SLL certificate like here:

export DATABASE_URL="mysql2://leder:[email protected]/pfhpdb?sslca=config/amazon-rds-ca-cert.pem"

when running my heroku rails 5 app w/ production environment and DB I get the following error:

ActionView::Template::Error (Can't connect to MySQL server on 'pfhpdb.cyo1f7mucyku.eu-central-1.rds.amazonaws.com' (101 "Network is unreachable")):

My database.yml is as follows:

production:
adapter: mysql2
encoding: utf8
host: pfhpdb.cyo1f7mucyku.eu-central-1.rds.amazonaws.com
database: pfhpdb
pool: 5
username: <%= ENV['RDS_USERNAME'] %>
password: <%= ENV['RDS_PASSWORD'] %>

Comment: same error when connecting to RDS w/ SQuirreL - class java.net.SocketException: Network is unreachable (connect failed)!

UPDATE 20200503: as of this post: Mariadb connection client: Access denied for user (using password: NO) on mysql 8.0

I cannot login w/ password in MariaDB and cannot change DB table access b/c I cannot login w/ password in MariaDB. I am shut off from my DB...

Upvotes: 0

Views: 907

Answers (2)

Leder
Leder

Reputation: 392

In the end the authentication error went away by resetting the AWS RDS DB administrator password in the console settings of RDS.

Upvotes: 0

Deepak Singhal
Deepak Singhal

Reputation: 10874

Please check security group of your RDS instance; probably you have not opened the port. Also, please try this to see if port is open or not.

$ telnet cyo1f7mucyku.eu-central-1.rds.amazonaws.com 3306

Upvotes: 1

Related Questions