Mysql::Error in SayController#hello

Hey guys
i’ve just started working through adgile web development with rails. The
first thing that it has guided me to do it to make the simple “Hello
World!” app. But i’ve come across a problem. Here is the error code:

Mysql::Error in SayController#hello
#28000Access denied for user ‘root’@‘localhost’ (using password: NO)
RAILS_ROOT: C:/ruby/demo

Application Trace | Framework Trace | Full Trace

c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/vendor/mysql.rb:523:in
read' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/vendor/mysql.rb:153:inreal_connect’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/connection_adapters/mysql_adapter.rb:471:in
connect' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/connection_adapters/mysql_adapter.rb:165:ininitialize’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/connection_adapters/mysql_adapter.rb:88:in
new' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/connection_adapters/mysql_adapter.rb:88:inmysql_connection’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:291:in
send' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:291:inconnection=’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:259:in
retrieve_connection' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:78:inconnection’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/query_cache.rb:8:in
cache' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.1/lib/action_controller/caching.rb:677:inperform_action’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.1/lib/action_controller/base.rb:524:in
send' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.1/lib/action_controller/base.rb:524:inprocess_without_filters’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.1/lib/action_controller/filters.rb:685:in
process_without_session_management_support' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.1/lib/action_controller/session_management.rb:123:inprocess’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.1/lib/action_controller/base.rb:388:in
process' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.1/lib/action_controller/dispatcher.rb:171:inhandle_request’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.1/lib/action_controller/dispatcher.rb:115:in
dispatch' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.1/lib/action_controller/dispatcher.rb:126:indispatch_cgi’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.1/lib/action_controller/dispatcher.rb:9:in
dispatch' c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.1/lib/webrick_server.rb:112:inhandle_dispatch’
c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.1/lib/webrick_server.rb:78:in
service' c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:inservice’
c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in run' c:/ruby/lib/ruby/1.8/webrick/server.rb:173:instart_thread’
c:/ruby/lib/ruby/1.8/webrick/server.rb:162:in start' c:/ruby/lib/ruby/1.8/webrick/server.rb:162:instart_thread’
c:/ruby/lib/ruby/1.8/webrick/server.rb:95:in start' c:/ruby/lib/ruby/1.8/webrick/server.rb:92:ineach’
c:/ruby/lib/ruby/1.8/webrick/server.rb:92:in start' c:/ruby/lib/ruby/1.8/webrick/server.rb:23:instart’
c:/ruby/lib/ruby/1.8/webrick/server.rb:82:in start' c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.1/lib/webrick_server.rb:62:indispatch’
c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.1/lib/commands/servers/webrick.rb:66
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
gem_original_require' c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:inrequire’
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.1/lib/active_support/dependencies.rb:496:in
require' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.1/lib/active_support/dependencies.rb:342:innew_constants_in’
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.1/lib/active_support/dependencies.rb:496:in
require' c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.1/lib/commands/server.rb:39 c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:ingem_original_require’
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
require' script/server:3 c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/vendor/mysql.rb:523:inread’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/vendor/mysql.rb:153:in
real_connect' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/connection_adapters/mysql_adapter.rb:471:inconnect’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/connection_adapters/mysql_adapter.rb:165:in
initialize' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/connection_adapters/mysql_adapter.rb:88:innew’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/connection_adapters/mysql_adapter.rb:88:in
mysql_connection' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:291:insend’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:291:in
connection=' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:259:inretrieve_connection’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:78:in
connection' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/query_cache.rb:8:incache’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.1/lib/action_controller/caching.rb:677:in
perform_action' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.1/lib/action_controller/base.rb:524:insend’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.1/lib/action_controller/base.rb:524:in
process_without_filters' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.1/lib/action_controller/filters.rb:685:inprocess_without_session_management_support’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.1/lib/action_controller/session_management.rb:123:in
process' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.1/lib/action_controller/base.rb:388:inprocess’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.1/lib/action_controller/dispatcher.rb:171:in
handle_request' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.1/lib/action_controller/dispatcher.rb:115:indispatch’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.1/lib/action_controller/dispatcher.rb:126:in
dispatch_cgi' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.1/lib/action_controller/dispatcher.rb:9:indispatch’
c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.1/lib/webrick_server.rb:112:in
handle_dispatch' c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.1/lib/webrick_server.rb:78:inservice’
c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in service' c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:inrun’
c:/ruby/lib/ruby/1.8/webrick/server.rb:173:in start_thread' c:/ruby/lib/ruby/1.8/webrick/server.rb:162:instart’
c:/ruby/lib/ruby/1.8/webrick/server.rb:162:in start_thread' c:/ruby/lib/ruby/1.8/webrick/server.rb:95:instart’
c:/ruby/lib/ruby/1.8/webrick/server.rb:92:in each' c:/ruby/lib/ruby/1.8/webrick/server.rb:92:instart’
c:/ruby/lib/ruby/1.8/webrick/server.rb:23:in start' c:/ruby/lib/ruby/1.8/webrick/server.rb:82:instart’
c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.1/lib/webrick_server.rb:62:in
dispatch' c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.1/lib/commands/servers/webrick.rb:66 c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:ingem_original_require’
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
require' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.1/lib/active_support/dependencies.rb:496:inrequire’
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.1/lib/active_support/dependencies.rb:342:in
new_constants_in' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.1/lib/active_support/dependencies.rb:496:inrequire’
c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.1/lib/commands/server.rb:39
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
gem_original_require' c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:inrequire’
script/server:3
Request
Parameters:

None

Show session dump


flash: !map:ActionController::Flash::FlashHash {}

Response
Headers:

{“cookie”=>[],
“Cache-Control”=>“no-cache”}

Btw i do have a password on my MYSQL account
Can anyone help
Thanks
Chris

If you haven’t already, you might check the config/database.yml file
and make sure the username and password fields are correct.

then you should modify the auto-generated database.yml file in
C:/ruby/demo/config

and change the username/password in development, test, and/or production
section…

all the necessary databases could be created by using:

rake db:create:all (if you haven’t done this…)

Dongyi

the thing is its not a database
its just a simple hello world app

On 17 Dec 2007, at 21:05, Chris W. wrote:

the thing is its not a database
its just a simple hello world app
By default rails will tend to assume you do have a database. The error
you’re getting is because rails is trying to setup its database
connection as part of setting up the query cache that surrounds each
action (this is new in 2.0). The easiest way out of here is to make
sure you’ve created the databases the app is looking for and given
your app access to them.

Fred

yup i tried that with the password
still doesn’t work :frowning:

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