Postgres: creating a username Postgres: creating a username heroku heroku

Postgres: creating a username


To expand a bit on TheDelChop's answerAfter installation you can run the following in the terminal:

createuser -P

(The -P is to add a password)

It will ask you for name, password, whether they are a superuser, can create new roles, and can create new db's. You probably won't need any of those permissions for rails.

Then create the database to run with the following role you created:

createdb -O ROLE_NAME_FROM_PREVIOUS_STEP NEW_DATABASE_NAME

And viola, you should be good to go.


Then you can use the pg binary command createuser in bash/zsh. Just answer the questions they will ask you, and don't setup the database.yml for production, Heroku will take care of that.