I'm able to type rails s without any issues inside of an app using postgres.app on Mac using postgres.app, however, when I go to localhost:3000 it gives me this error:
PG::ConnectionBad
FATAL: role "myapp" does not exist
I thought at first the problem was the database.yml file but heroku docs even say to have it the way it is: https://devcenter.heroku.com/articles/getting-started-with-rails4
development:
adapter: postgresql
encoding: unicode
database: myapp_development
pool: 5
username: myapp
password:
Here is my full log. I've seen similar issues but they only vaguely relate to this.
snippet:
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
any suggestions?
It would appear that you have not created a user account for the application. In psql
:
CREATE USER myapp WITH PASSWORD 'thepassword';
You'll also need to create a DB if you haven't:
CREATE DATABASE myapp_development OWNER myapp;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With