Issue with running rails application on MySQL2 AWS RDS instance

Hi,

While trying to access my rails application on AWS, I get following
error
related to MySQL:

Access denied for user ‘aa58hsbjqdy3se’@‘172.31.29.107’ (using
password:
YES) (Mysql2::Error)

/usr/share/ruby/1.9/gems/1.9.1/gems/mysql2-0.3.14/lib/mysql2/client.rb:67:in
connect' /usr/share/ruby/1.9/gems/1.9.1/gems/mysql2-0.3.14/lib/mysql2/client.rb:67:ininitialize’
/usr/share/ruby/1.9/gems/1.9.1/gems/activerecord-mysql2-adapter-0.0.3/lib/active_record/connection_adapters/mysql2_adapter.rb:14:in
new' /usr/share/ruby/1.9/gems/1.9.1/gems/activerecord-mysql2-adapter-0.0.3/lib/active_record/connection_adapters/mysql2_adapter.rb:14:inmysql2_connection’
/usr/share/ruby/1.9/gems/1.9.1/gems/activerecord-3.2.15/lib/active_record/connection_adapters/abstract/connection_pool.rb:315:in
new_connection' /usr/share/ruby/1.9/gems/1.9.1/gems/activerecord-3.2.15/lib/active_record/connection_adapters/abstract/connection_pool.rb:325:incheckout_new_connection’
/usr/share/ruby/1.9/gems/1.9.1/gems/activerecord-3.2.15/lib/active_record/connection_adapters/abstract/connection_pool.rb:247:in
block (2 levels) in checkout' /usr/share/ruby/1.9/gems/1.9.1/gems/activerecord-3.2.15/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:inloop’
/usr/share/ruby/1.9/gems/1.9.1/gems/activerecord-3.2.15/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in
block in checkout' /usr/share/ruby/1.9/monitor.rb:211:inmon_synchronize’
/usr/share/ruby/1.9/gems/1.9.1/gems/activerecord-3.2.15/lib/active_record/connection_adapters/abstract/connection_pool.rb:239:in
checkout' /usr/share/ruby/1.9/gems/1.9.1/gems/activerecord-3.2.15/lib/active_record/connection_adapters/abstract/connection_pool.rb:102:inblock in connection’
/usr/share/ruby/1.9/monitor.rb:211:in mon_synchronize' /usr/share/ruby/1.9/gems/1.9.1/gems/activerecord-3.2.15/lib/active_record/connection_adapters/abstract/connection_pool.rb:101:inconnection’
/usr/share/ruby/1.9/gems/1.9.1/gems/activerecord-3.2.15/lib/active_record/connection_adapters/abstract/connection_pool.rb:410:in
retrieve_connection' /usr/share/ruby/1.9/gems/1.9.1/gems/activerecord-3.2.15/lib/active_record/connection_adapters/abstract/connection_specification.rb:171:inretrieve_connection’
/usr/share/ruby/1.9/gems/1.9.1/gems/activerecord-3.2.15/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:in
connection' /usr/share/ruby/1.9/gems/1.9.1/gems/activerecord-3.2.15/lib/active_record/model_schema.rb:310:inclear_cache!’
/usr/share/ruby/1.9/gems/1.9.1/gems/activerecord-3.2.15/lib/active_record/railtie.rb:103:in
block (2 levels) in <class:Railtie>' /usr/share/ruby/1.9/gems/1.9.1/gems/activesupport-3.2.15/lib/active_support/callbacks.rb:418:in_run__1050994583__prepare__640699132__callbacks’
/usr/share/ruby/1.9/gems/1.9.1/gems/activesupport-3.2.15/lib/active_support/callbacks.rb:405:in
__run_callback' /usr/share/ruby/1.9/gems/1.9.1/gems/activesupport-3.2.15/lib/active_support/callbacks.rb:385:in_run_prepare_callbacks’
/usr/share/ruby/1.9/gems/1.9.1/gems/activesupport-3.2.15/lib/active_support/callbacks.rb:81:in
run_callbacks' /usr/share/ruby/1.9/gems/1.9.1/gems/actionpack-3.2.15/lib/action_dispatch/middleware/reloader.rb:74:inprepare!’
/usr/share/ruby/1.9/gems/1.9.1/gems/actionpack-3.2.15/lib/action_dispatch/middleware/reloader.rb:48:in
prepare!' /usr/share/ruby/1.9/gems/1.9.1/gems/railties-3.2.15/lib/rails/application/finisher.rb:47:inblock in module:Finisher
/usr/share/ruby/1.9/gems/1.9.1/gems/railties-3.2.15/lib/rails/initializable.rb:30:in
instance_exec' /usr/share/ruby/1.9/gems/1.9.1/gems/railties-3.2.15/lib/rails/initializable.rb:30:inrun’
/usr/share/ruby/1.9/gems/1.9.1/gems/railties-3.2.15/lib/rails/initializable.rb:55:in
block in run_initializers' /usr/share/ruby/1.9/gems/1.9.1/gems/railties-3.2.15/lib/rails/initializable.rb:54:ineach’
/usr/share/ruby/1.9/gems/1.9.1/gems/railties-3.2.15/lib/rails/initializable.rb:54:in
run_initializers' /usr/share/ruby/1.9/gems/1.9.1/gems/railties-3.2.15/lib/rails/application.rb:136:ininitialize!’
/usr/share/ruby/1.9/gems/1.9.1/gems/railties-3.2.15/lib/rails/railtie/configurable.rb:30:in
method_missing' /var/app/current/config/environment.rb:5:in<top (required)>’
config.ru:3:in require' config.ru:3:inblock in ’
/usr/share/ruby/1.9/gems/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in
instance_eval' /usr/share/ruby/1.9/gems/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:ininitialize’
config.ru:1:in new' config.ru:1:in
/usr/share/ruby/1.9/gems/1.9.1/gems/passenger-4.0.20/helper-scripts/rack-preloader.rb:105:in
eval' /usr/share/ruby/1.9/gems/1.9.1/gems/passenger-4.0.20/helper-scripts/rack-preloader.rb:105:inpreload_app’
/usr/share/ruby/1.9/gems/1.9.1/gems/passenger-4.0.20/helper-scripts/rack-preloader.rb:150:in
<module:App>' /usr/share/ruby/1.9/gems/1.9.1/gems/passenger-4.0.20/helper-scripts/rack-preloader.rb:29:inmodule:PhusionPassenger
/usr/share/ruby/1.9/gems/1.9.1/gems/passenger-4.0.20/helper-scripts/rack-preloader.rb:28:in
`’

My database.yml looks like this:

production:
adapter: mysql2
encoding: utf8
database: ebdb
host: aaashxwkmkl2su.cob702nyjvgo.ap-southeast-1.rds.amazonaws.com
port: 3306
username: aa58hsbjqdy3se
password: ********

I have given db username as what I see in ‘DB Instance Identifier’ field
for my RDS instance(screenshot attached). The password I am providing is
same as what I provided while creating this RDS instance using eb
command
line tool. I also reset the password again to same value in “New Master
Password” field in the attached screenshot to confirm if there are any
credential issues. But that didn’t help.

I am clueless about this error. Can someone please help me in resolving
this issue?

Thanks.

On Monday, January 13, 2014 5:44:34 AM UTC, Ankur wrote:

I have given db username as what I see in ‘DB Instance Identifier’ field
for my RDS instance(screenshot attached). The password I am providing is
same as what I provided while creating this RDS instance using eb command
line tool. I also reset the password again to same value in “New Master
Password” field in the attached screenshot to confirm if there are any
credential issues. But that didn’t help.

The default username is not the db instance identifier. The default is
awsuser but this can be set to anything when creating the database. If
you’re using elasticbeanstalk then the relevant connection details
should
be available in the environment
(
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_Ruby.rds.html#create_deploy_Ruby.rds.newDB
)

Fred

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs