5

I'm joining a project and am a bit confused because it doesn't have a database.yml file. So when I try to run "rake db:schema:load" or "rake db:setup", I get a complaint about the missing file.

I've spent more time with Mongo than MySQL so I'm not sure if it's standard to just make your database.yml by hand or through a rake task that I'm not seeing, or if the fact that it is missing is a problem.

Jeremy Smith
  • 14,727
  • 19
  • 67
  • 114
  • http://stackoverflow.com/questions/6824036/rails-local-server-error-no-such-file-database-yml MAYBE that is the solution to your question !! – Muhammad Umar Sep 17 '11 at 15:36

1 Answers1

11

I guess your team intentionally exclude this file out from project due to this file contains DB's password.

You can create your own database.yml file (it's located at config/database.yml) ex.

 development:
   adapter: mysql
   database: rails_dev
   username: dev
   password: devpwd

 test:
   adapter: mysql
   database: rails_test
   username: test
   password: testpwd

 production:
   adapter: mysql
   database: rails_prod
   username: prod
   password: prodpwd

Edit: To secure your configuration file, you could use environment variable instead e.g.

  password: <%= ENV['APPNAME_PROD_PWD'] %>

This way you could store your configuration file in public area.

datalost
  • 3,765
  • 1
  • 25
  • 32
  • There should be a better way to do that, e.g. By splitting it, or dismissing the production password. – mliebelt Sep 17 '11 at 16:33
  • Thanks, I am working through the Rails tutorials by Michael Hartl and just switched to a different computer, pulled down the files from my git repo, and forgot that he had recommended putting the database.yml file in .gitignore –  Aug 08 '13 at 02:00