问题
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...
回答1:
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
回答2:
In the end the authentication error went away by resetting the AWS RDS DB administrator password in the console settings of RDS.
来源:https://stackoverflow.com/questions/61560947/error-connecting-rails-5-app-database-yml-to-aws-rds-instance