Cannot connect to MySql

HI Everyone,

me new to Ruby on Rails, For me its getting difficult to connect To Database . Previously i followed some tutorial and installed sqlite , Now when i change the configuration file (database.yml)configurations from sqlite to mysql im getting problems.

when me trying to hit the following command. C:\rails\connect>ruby script/generate controller list me getting the following error.

c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/connection_a dapters/abstract/connection_specification.rb:218:in `establish_connection': deve lopment database is not configured (ActiveRecord::AdapterNotSpecified)         from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record /connection_adapters/abstract/connection_specification.rb:209:in `establish_conn ection'         from c:/ruby/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/initializer.rb:332:i n `initialize_database'         from c:/ruby/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/initializer.rb:120:i n `process'         from c:/ruby/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/initializer.rb:93:in `send'         from c:/ruby/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/initializer.rb:93:in `run'         from C:/rails/connect/config/environment.rb:13         from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `ge m_original_require'         from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `re quire'         from c:/ruby/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/commands/generate.rb :1         from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `ge m_original_require'         from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `re quire'         from script/generate:3

                     Thanks for help in advance.

Hi

I guess each beginner on rails would face this problem I faced it too when i started working on rails :slight_smile:

the solution is to create a new project using this command

rails project -d mysql

-d mysql will generate the database.yml for mysql in accordance to your platform

so copy this file and paste it in your original project, restart the server, and enjoy

if anyone has a better way, please do tell us

thanks