Rails: FATAL - Peer authentication failed for user (PG::Error)

后端 未结 8 658
心在旅途
心在旅途 2020-12-04 04:22

I am running my development on Ubuntu 11.10, and RubyMine

Here is my development settings for the database.yml: which RubyMine created for me

develop         


        
8条回答
  •  一向
    一向 (楼主)
    2020-12-04 05:11

    If you installed postresql on your server then just host: localhost to database.yml, I usually throw it in around where it says pool: 5. Otherwise if it's not localhost definitely tell that app where to find its database.

    development:
      adapter: postgresql
      encoding: unicode
      database: kickrstack_development
      host: localhost
      pool: 5
      username: kickrstack
      password: secret
    

    Make sure your user credentials are set correctly by creating a database and assigning ownership to your app's user to establish the connection. To create a new user in postgresql 9 run:

    sudo -u postgres psql
    

    set the postgresql user password if you haven't, it's just backslash password.

    postgres=# \password
    

    Create a new user and password and the user's new database:

    postgres=# create user "guy_on_stackoverflow" with password 'keepitonthedl';
    postgres=# create database "dcaclab_development" owner "guy_on_stackoverflow"; 
    

    Now update your database.yml file after you've confirmed creating the database, user, password and set these privileges. Don't forget host: localhost.

提交回复
热议问题