rake db:create throws “database does not exist” error with postgresql

Rails 4.1 ships with spring preloader, and

New Rails 4.1 applications will ship with “springified” binstubs. This means that bin/rails and bin/rake will automatically take advantage of preloaded spring environments.

which means that the “springified” bin/rake will attempt to preload the app, which in turn will attempt to run the initilizers resulting in the problem you’re seeing.

To fix / work around this you want to run the initial setup rake tasks without spring. One way to achieve that is to run it with bundler instead:

bundle exec rake db:create

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)