2

I want to create a PostgreSQL database on a Heroku server.

My database.yml is

production:
  adapter: postgresql

  encoding: utf8

  database: ddb
  username: postgres

  port: 5432
  password: admin

  host: localhost

When I run heroku rake db:create it gives me the error:

mydatabase already exists
    (in /disk1/home/slugs/181380_8d7032f_f439-4fe4f5a6-f181-4150-a968-fadcf45f0af5/mnt)

I have tried it for various different database names, but get the same message.

How can I resolve this error?

1
  • A wild guess: the config file you cited is not the config file Heroku sees. Look for a similar file with a "database: mydatabase" in it. Commented Nov 8, 2010 at 15:22

1 Answer 1

15

heroku autogenerates database.yml on the deploy. Reads like: it doesn't matter what you put in your database.yml, which to me is nice, as I can include it in git without worrying about production db passwords.

You may choose another database by setting the ENV['DATABASE_URL'] (use heroku config:add DATABASE_URL=....)

Check heroku documentation https://devcenter.heroku.com/articles/ruby-support#build-behavior

Sign up to request clarification or add additional context in comments.

1 Comment

Heroku does not autogenerate database.yml after Rails 4.1 devcenter.heroku.com/articles/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.