0

When i try to make postgres work with Rails.

FATAL: Peer authentication failed for user "postgres"

i have 9.6 version and 9.5 postgresql i remember i created a user called postgresql

for connect with it i do first:
sudo su
su - postgres
psql
\l

My users: http://pastebin.com/kKH4qjsr Here's my pg_hba.conf : http://pastebin.com/VnxbQCDW i put in my project postgres but i cannot connect

ito2307ht
  • 13
  • 1
  • 9
  • Hi and welcome to Stack Overflow. Here we like our questions to live forever - and pastebins come and go like snowflakes... can you please edit your question and add the details into your original question, so that it will live on and on (we like this in case other people come across the same problem in future)? On top of this - please add any relevant code to your question. What you have tried to do to fix the error. any error messages you got etc – Taryn East Oct 17 '16 at 22:58
  • Can you add a print out of the posgres users and their permissions see here http://unix.stackexchange.com/questions/201666/command-to-list-postgresql-user-accounts – C dot StrifeVII Oct 17 '16 at 22:59
  • show this : psql -U postgres psql: FATAL: Peer authentication failed for user "postgres", then i've ti di sudo su for connect with the root, su - postgres, psql i followed your link @CdotStrifeVII http://pastebin.com/bMWUWB3w – ito2307ht Oct 17 '16 at 23:24
  • So I am not a pg expert, but I have run into this issue before. One more thing what exactly are you doing that is causing this error I don't know what you mean by trying to make pg work with rails. Also it just sounds like you need to create a user name `postgres`. – C dot StrifeVII Oct 17 '16 at 23:46
  • http://imgur.com/a/d7k4F – ito2307ht Oct 18 '16 at 00:01
  • i'm followed this tutorial and typed rake db:create and display this errors http://pastebin.com/UKtXaVNy – ito2307ht Oct 19 '16 at 21:39

1 Answers1

0

In your pg_hba.conf file, use the trust auth method instead of md5:

# IPv4 local connections:

host    all             all             127.0.0.1/32            trust
pietrop
  • 1,071
  • 2
  • 10
  • 27