Question

Database connection error on Rails application with postgresql database

Good day! Could You help me with issue after installing RoR image with postgresql - generate model and after it make migration: rake db:migrate RAILS_ENV=production. Get a mistake - “PG:ConnectionBad: fe_sendauth: no password supplied”. What can I do? (export APP_DATABASE_PASSWORD=**** helps only if there is no restart).

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hello,

I was having the same error, and for me the environment variables wan’t set. It was just a matter of executing “. /etc/default/unicorn” as seem here to properly setup the variables.

After that all started working again.

Can you verify if the database works outside of the Rails environment?

What happens when you run these commands in console/terminal?

Run a login test:

psql -U postgres

Run a port test:

netstat -nlp | grep 5432