Rails and PostgreSQL: Role postgres does not exist

前端 未结 13 2158
一整个雨季
一整个雨季 2020-12-07 07:51

I have installed PostgreSQL on my Mac OS Lion, and am working on a rails app. I use RVM to keep everything separate from my other Rails apps.

For some reason when I

13条回答
  •  太阳男子
    2020-12-07 08:33

    I met this issue right on when I first install the Heroku's POSTGRES.app thing. After one morning trial and error i think this one line of code solved problem. As describe earlier, this is because postgresql does not have default role the first time it is set up. And we need to set that.

    sovanlandy=# CREATE ROLE postgres LOGIN;
    

    You must log in to your respective psql console to use this psql command.

    Also noted that, if you already created the role 'postgre' but still get permission errors, you need to alter with command:

    sovanlandy=# ALTER ROLE postgres LOGIN;
    

    Hope it helps!

提交回复
热议问题