FATAL: role “root” does not exist

前端 未结 3 1959
后悔当初
后悔当初 2021-01-22 07:24

I have started to learn using heroku and i was trying to execute bundle exec rake db:create db:migrate command, i have encountered the following errors,

         


        
3条回答
  •  庸人自扰
    2021-01-22 07:47

    The problem is that you don't have ROLE on your local machine named root. Run this in a terminal:

    psql
    

    Then if you connect with PostgreSQL in your terminal:

    CREATE ROLE root WITH PASSWORD 'root' WITH CREATEDB LOGIN CREATEROLE CREATEUSER SUPERUSER;
    

    or just change in your database.yml file user to user, who exists with valid password.

    P.S.

    Don't run in your terminal:

    heroku run rake db:create
    

    Heroku creates for you database when you first time push your application to Heroku's servers.

    But you can run:

    heroku run rake db:migrate
    

提交回复
热议问题