Issue with running rails application on MySQL2 AWS RDS instance

99 views
Skip to first unread message

Ankur Kumar

unread,
Jan 13, 2014, 12:44:34 AM1/13/14
to rubyonra...@googlegroups.com
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:in `initialize'
/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:in `mysql2_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:in `checkout_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:in `loop'
/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: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: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:in `block 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:in `connection'
/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: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:145:in `connection'
/usr/share/ruby/1.9/gems/1.9.1/gems/activerecord-3.2.15/lib/active_record/model_schema.rb:310:in `clear_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:in `prepare!'
/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:in `block 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:in `run'
/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:in `each'
/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:in `initialize!'
/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:in `block in <main>'
/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:in `initialize'
config.ru:1:in `new'
config.ru:1:in `<main>'
/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:in `preload_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:in `<module:PhusionPassenger>'
/usr/share/ruby/1.9/gems/1.9.1/gems/passenger-4.0.20/helper-scripts/rack-preloader.rb:28:in `<main>'

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.

RDS.png

Frederick Cheung

unread,
Jan 13, 2014, 4:50:37 AM1/13/14
to rubyonra...@googlegroups.com


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


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.

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
Reply all
Reply to author
Forward
0 new messages