2014-03-25 8 views
5

Ich bin in der Lage, Rails s ohne Probleme innerhalb einer App mit postgres.app auf Mac mit postgres.app eingeben, aber wenn ich zu localhost gehe: 3000 es gibt mir diese Fehlermeldung:PG :: ConnectionBad FATAL: Rolle "myapp" existiert nicht

PG::ConnectionBad 
FATAL: role "myapp" does not exist 

ich dachte zuerst, das Problem war die database.yml Datei aber Heroku docs sagen sogar die Möglichkeit zu haben, es ist: https://devcenter.heroku.com/articles/getting-started-with-rails4

development: 
adapter: postgresql 
encoding: unicode 
database: myapp_development 
pool: 5 
username: myapp 
password: 

Hier ist mein vollständiges Protokoll Ich habe ähnliche Probleme gesehen, aber sie beziehen sich nur vage darauf.

Schnipsel:

Started GET "/" for 127.0.0.1 at 2014-03-25 16:48:31 -0600 

PG::ConnectionBad (FATAL: role "myapp" does not exist 
): 
    activerecord (4.0.2) lib/active_record/connection_adapters/postgresql_adapter.rb:831:in `initialize' 
    activerecord (4.0.2) lib/active_record/connection_adapters/postgresql_adapter.rb:831:in `new' 
    activerecord (4.0.2) lib/active_record/connection_adapters/postgresql_adapter.rb:831:in `connect' 
    activerecord (4.0.2) lib/active_record/connection_adapters/postgresql_adapter.rb:548:in `initialize' 
    activerecord (4.0.2) lib/active_record/connection_adapters/postgresql_adapter.rb:41:in `new' 
    activerecord (4.0.2) lib/active_record/connection_adapters/postgresql_adapter.rb:41:in `postgresql_connection' 
    activerecord (4.0.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:440:in `new_connection' 
    activerecord (4.0.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:450:in `checkout_new_connection' 
    activerecord (4.0.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:421:in `acquire_connection' 
    activerecord (4.0.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:356:in `block in checkout' 
    /Users/johncurry/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize' 
    activerecord (4.0.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:355:in `checkout' 
    activerecord (4.0.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:265:in `block in connection' 
    /Users/johncurry/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize' 
    activerecord (4.0.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:264:in `connection' 
    activerecord (4.0.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:546:in 

irgendwelche Vorschläge?

+1

Mögliche Duplikat [PG :: ConnectionBad FATAL: Rolle "Myname" existiert nicht] (http://stackoverflow.com/questions/23338356/pgconnectionbad-fatal-role-myname-does-not-exist) – Meekohi

Antwort

0

Sie müssen den Postgres-Benutzer auf Ihrem lokalen Computer erstellen. Die Rolle ist Ihr Benutzername.

12

Es scheint, dass Sie kein Benutzerkonto für die Anwendung erstellt haben. In psql:

CREATE USER myapp WITH PASSWORD 'thepassword'; 

werden Sie müssen auch ein DB erstellen, wenn Sie nicht haben:

CREATE DATABASE myapp_development OWNER myapp; 
+0

ist "Besitzer" der App-Besitzer - oder nur buchstäblich "Besitzer" –

+1

buchstäblich "Besitzer". Es ist ein Schlüsselwort. Siehe Handbuch für 'CREATE DATABASE'. –

+0

Danke für die Auszeichnung. –

Verwandte Themen