简体   繁体   中英

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

I already set up SLL certificate like here:

export DATABASE_URL="mysql2://leder:password@pfhpdb.cyo1f7mucyku.eu-central-1.rds.amazonaws.com/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...

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM