Question

PG::ConnectionBad fe_sendauth: no password supplied

When i created a droplet ubuntu 16 rails one click with rails 5 “PG::ConnectionBad fe_sendauth: no password supplied” , new york or san francisco options or anywhere.

If a tried to do “rails db:migrate” show me this error …i tried to create another super user and change the credentials from database.yaml but continues with the same error

in some posts the people say that is an error when the doplet is created

How i can resolved? please this si the second droplet that i created

p.d : sorry for my english , i speack spanish


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.

Andy Hattemer
DigitalOcean Employee
DigitalOcean Employee badge
May 14, 2020
Pinned Answer

If you look in your config/database.yml file, you are probably specifying localhost as the database host name, and you are probably not supplying a password.

Using localhost automatically switches the connection to a TCP connection, and by default in postgres, TCP connection auth method is md5 (password required).

Here are two ways to solve:

Switch to UNIX Socket connection - If you’re just running the postgres db in the same VM as Rails, you can switch from TCP to UNIX Socket connection by removing localhost from the host parameter in config/database.yml:

from:

development:
  adapter: postgresql
  ...
  host: localhost
  ...

to:

development:
  adapter: postgresql
  ...
  host: ''
  ...

Specify a Password: - If you need to connect over TCP, make sure the username you are using in config/database.yml is configured in postgres and set a password by connecting to the postgres db from the command line and running:

ALTER USER postgres PASSWORD 'myPassword';

and then specify the same password in your config/database.yml file:

development:
  adapter: postgresql
  ...
  host: localhost
  password: 'myPassword'
  ...

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel