PG::ConnectionBad: FATAL: password authentication failed for user “alphauser”

后端 未结 4 778
情书的邮戳
情书的邮戳 2021-01-02 03:40

I\'m working on an application in Rails for my college. The application was started by the students from previous year and now it\'s me and my colleagues turn to continue wo

相关标签:
4条回答
  • 2021-01-02 04:06

    Try to use:

    sudo -u postgres createuser --interactive --pwprompt

    to add the role and the password

    0 讨论(0)
  • 2021-01-02 04:27

    You have to create corresponding user and database manually like this:

    in shell: psql

    then:

      create user alphauser with password 'alphapassword';
      create database alpha_database owner alphauser;
      alter user alphauser superuser createrole createdb replication;
      \q
    

    don't forget semicolons.

    0 讨论(0)
  • 2021-01-02 04:31
     create user alphauser with password 'alphapassword';
    

    Then

    rake db:setup
    
    0 讨论(0)
  • 2021-01-02 04:32

    So the problem is with your rails application using the database.yml file to try and connect to your local database and failing to find the user alphauser (since I assume you're using different computers/environments as the previous students).

    Databases have users similar to applications, the postgres documentation is pretty dense on this, but I would guess if you can create a user alphauser, and make it's password alphapassword then you will have a new clean database for your app that you can run rake db:migrate on.

    Postgres docs: http://www.postgresql.org/docs/9.2/static/app-createuser.html

    Try running this command from the command line createuser -P -s -e alphauser

    This will prompt for a password, which is alphauserpassword

    0 讨论(0)
提交回复
热议问题