rake aborted! ERROR: must be owner of database

前端 未结 2 1961
执笔经年
执笔经年 2021-02-07 19:54

I am working through Michael Hartl\'s excellent tutorial but when trying to prepare the test database with the command: bundle exec rake db:test:prepare I get this error messag

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-07 20:06

    First post, writing this down for posterity. I was having the same problem but was able to fix it. You just have to make sure you were/are signed in as a superuser when you create your databases (or the one that is throwing the error).

    I was logging into psql with this code:

    sudo sudo -u postgres psql 
    

    And created my databases. This is bad. You want to log in with these superuser credentials:

    sudo su - postgres
    

    And then after you're logged in to postgres:

    psql 
    

    Then create your databases. You can kill your old databases with the command

    DROP DATABASE "database_to_drop";
    

    Recreate them and you should be good to go!

提交回复
热议问题