Can't connect to PostgreSQL with Rails 4 and CentOS 6.5

March 29, 2014 2.9k views
Hi folks, I have a Rails 4 app which I want to deploy and first I have to connect it to the DB. So I went to the Postgres console and ran: create role somosprof with createdb createrole replication login password 'mySafePWSD'; And the user was properly created. Then I placed the configuration info into the config/database.yml file: production: adapter: postgresql encoding: unicode database: somosprofessores_production pool: 5 username: somosprof password: mySafePWSD But when I run rake db:migrate I get the following error: [root@somosp somosprofessores]# RAILS_ENV=production rake db:create You no longer need to have jasmine.rake in your project, as it is now automatically loaded from the Jasmine gem. To silence this warning, set "USE_JASMINE_RAKE=true" in your environment or remove jasmine.rake. FATAL: Peer authentication failed for user "somosprof" What is going on? Please help me, this is very urgent and I have no idea on why it isn't working
3 Answers
Your config/database.yml file you don't have a host value. Try adding "host: localhost" assuming that you're running postgresql on the same droplet as the rails app. Let us know if you're still having any issues!
Hey, I've been getting a similar error. Localhost is specified. I can start postgresql. I've edited postgresql.conf to listen on localhost. I've edited pg_hba.conf from peer to trust. I'm baffled at this point. If anyone has any last ditch efforts, please let me know. I've tried changing the setting and creating new DBs with privileges and restarting postgresql with no avail. I have no idea what to do at this point. Please help! Thanks!
How did you create the database? Using rake or manually? Are you sure the postgres service is started?

service postgres start
Have another answer? Share your knowledge.