0

I followed this tutorial https://gorails.com/setup/ubuntu/16.04 and i created my project: rails new myapp -d postgresql, but when i ran rake db:create display those messages http://pastebin.com/UKtXaVNy How can i fix it? i tried a lot of stuff i check it out, but doesn't work for me Getting error: Peer authentication failed for user "postgres", when trying to get pgsql working with rails .

Community
  • 1
  • 1
ito2307ht
  • 13
  • 1
  • 9

1 Answers1

0

On lines 50/51 of the error message you pasted you've got this:

50: Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"unicode", "username"=>"root", "password"=>"secret", "pool"=>5, "database"=>"myipad_developme nt"} 51: FATAL: Peer authentication failed for user "root"

Have you created a user named "root" with a password of "secret" on the PostgreSQL database? The gorails tutorial talks about setting up a username of "chris".

Look in your myipad/config/database.yml file to see where you'd configure a different login before re-running rake db:create.

Trevor Tippins
  • 2,827
  • 14
  • 10
  • i added it in myipad/config/database.yml username: root password: secret – ito2307ht Oct 19 '16 at 22:08
  • okay i created the user: root with password: secret and i added it in the database.yml – ito2307ht Oct 19 '16 at 22:10
  • OK. So if you've also done "sudo postgres createuser root -s" and set a password of "secret" and it's still going wrong I don't think I have sufficient information to be able to help. – Trevor Tippins Oct 19 '16 at 22:11
  • that other information can I place here?, I need help, many days I've been trying to set up postgresql in my vagrant+rails – ito2307ht Oct 19 '16 at 22:14
  • You could try taking a look at this, maybe it'll help. http://dba.stackexchange.com/questions/131129/psql-fatal-peer-authentication-failed-for-user – Trevor Tippins Oct 19 '16 at 22:26
  • my gem 'pg', '~> 0.15' – ito2307ht Oct 19 '16 at 22:26
  • http://imgur.com/a/5PqvX display this message error and my pg_hba.conf http://imgur.com/a/KwYL7 – ito2307ht Oct 19 '16 at 22:30
  • You could try commenting out that local all all peer line in pg_hba.conf as suggested in that other thread. – Trevor Tippins Oct 19 '16 at 22:36
  • okay i comment that local all all peer and display this http://imgur.com/a/j5py4 i can created the myuser with the user root.. sudo su, well now i created manual the database myipad_development and myipad_test but now show me this. the first link – ito2307ht Oct 19 '16 at 22:45
  • Take a look at the documentation for pg_hba.conf https://www.postgresql.org/docs/current/static/auth-pg-hba-conf.html - you're going to need a line in there that covers your login.- if you're using a password then you need an auth-method of "password" I would think. – Trevor Tippins Oct 19 '16 at 22:53
  • i got the answer with this http://imgur.com/a/eibJq i edited my pg_hba.conf with the user root: local all myuser md5 but before i create the user named myuser with password 'secret' with the superuser of ubuntu and i created the databases manually – ito2307ht Oct 20 '16 at 00:44