Not able to run webrick server in windows

Hi ,

I am new to ruby on rails. I have Windows Xp Rails 2.3.4 MySql

                                   I am not able to start webrick server

                             I have followed steps for creating new project given                                Getting Started with Rails — Ruby on Rails Guides

rails abhi_blog -d mysql cd abhi_blog

Issue 1: when i run below command,                ruby script/generate controller home index

               I am getting this error C:\Ruby\Abhi_My Ruby\Ruby on Rails\abhi_blog>ruby script/generate controller hom e index C:/Ruby/lib/ruby/1.8/yaml.rb:133:in `load': syntax error on line 24, col 2: ` h ost: localhost' (ArgumentError)         from C:/Ruby/lib/ruby/1.8/yaml.rb:133:in `load'         from C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/ initializer.rb:902:i n `database_configuration'         from C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/ initializer.rb:437:i n `initialize_database'         from C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/ initializer.rb:141:i n `process'         from C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/ initializer.rb:113:i n `send'         from C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/ initializer.rb:113:i n `run'         from C:/Ruby/Abhi_My Ruby/Ruby on Rails/abhi_blog/config/ environment.rb: 9         from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb: 31:in `ge m_original_require'         from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb: 31:in `re quire'         from C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/commands/ generate.rb :1         from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb: 31:in `ge m_original_require'         from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb: 31:in `re quire'         from script/generate:3

Issue 2: When i try to start the server                ruby script/server

C:\Ruby\Abhi_My Ruby\Ruby on Rails\abhi_blog>ruby script/server => Booting WEBrick => Rails 2.3.4 application starting on http://0.0.0.0:3000 C:/Ruby/lib/ruby/1.8/yaml.rb:133:in `load': syntax error on line 24, col 2: ` h ost: localhost' (ArgumentError)         from C:/Ruby/lib/ruby/1.8/yaml.rb:133:in `load'         from C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/ initializer.rb:902:i n `database_configuration'         from C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/ initializer.rb:437:i n `initialize_database'         from C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/ initializer.rb:141:i n `process'         from C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/ initializer.rb:113:i n `send'         from C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/ initializer.rb:113:i n `run'         from C:/Ruby/Abhi_My Ruby/Ruby on Rails/abhi_blog/config/ environment.rb: 9         from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb: 31:in `ge m_original_require'         from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb: 31:in `re quire'         from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/ active_suppo rt/dependencies.rb:156:in `require'         from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/ active_suppo rt/dependencies.rb:521:in `new_constants_in'         from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/ active_suppo rt/dependencies.rb:156:in `require'         from C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/commands/ server.rb:8 4         from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb: 31:in `ge m_original_require'         from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb: 31:in `re quire'         from script/server:3

Did you configure the database: http://guides.rubyonrails.org/getting_started.html#configuring-a-database

Darian Shimy

Hi Darian,

I have configured my database.This is my database.yml

development:

adapter: mysql

encoding: utf8

reconnect: false

database: abhidb

pool: 5

username: root

password:root

host: localhost

Warning: The database defined as “test” will be erased and

re-generated from your development database when you run “rake”.

Do not set this db to the same as development or production.

test:

adapter: mysql

encoding: utf8

reconnect: false

database: abhidb

pool: 5

username: root

password:root

host: localhost

production:

adapter: mysql

encoding: utf8

reconnect: false

database: abhidb

pool: 5

username: root

password: root

host: localhost

Not sure if this will help, but try adding a space between the password:

From this:

password:root

to this:

password: root

Darian Shimy

Hi Darian,

Thanks for the solution.

It worked.