Trying to set up postgres for ror app, getting error - fe_sendauth: no password supplied
You need to change your change your pg_hba.conf
. Here's an example of mine:
pg_hba.conf
:
TYPE DATABASE USER ADDRESS METHOD
host all all 127.0.0.1/32 trust
host all PC 127.0.0.1/32 trust
host all all ::1/128 trust
Note that trust
means that anyone on address
(in this case localhost) can connect as the listed user (or in this case any user of their choice). This is really only suitable for development configurations with unimportant data. Do not use this in production.
Rails + Postgres fe_sendauth: no password supplied
First you should change:
local all all trust
to:
local all all md5
Then, You should create a super_user in PostgreSQL with username
and password
,after that adding username
and password
of new user to your database.yml
file.
To create new super_user
, open Pg Admin III
and right click at the bottom Login Roles
to create new super user.
Rails: fe_sendauth: no password supplied (PG::ConnectionBad) from Ruby, but ok in Rails
You don't specify neither username, no password in your ActiveRecord::Base.establish_connection(
. I assume you want to use some SUPERUSER
without password for www_development
database - right?
as per documentation peer auth does
Obtain the client's operating system user name from the operating
system and check if it matches the requested database user name.
That is why if you can psql
without password, you should be able run app.rb
with same OS user and environment without password. If you can't, then app.rb
tries to connect with different username or so...
Options:
put
username: postgres
toActiveRecord::Base.establish_connection(
change
local all all peer
tolocal all all trust
How to resolve the error 'fe_sendauth: no password supplied' in Rails using PostgreSQL?
My solution to this problem was to remove host: localhost
from the default:
group.
postgresql database migration error: PG::ConnectionBad: fe_sendauth: no password supplied
Whao... after searching more on stackoverflow
, I got this question, which points to this documentation.
On following that, and configuring my .pgpass
file with default username
and password
as said in the documentation, all worked fine!!!!
Although, I still do not understand why it was previously working for my test env database, but not the development env database.
Rails Postgres Github Actions error: PG::ConnectionBad: fe_sendauth: no password supplied
The issue is a simple omission from the configuration file: I set the env
variables section for the Setup database
step, but not the Run tests
step. As a result, the error is correct, during that step, there is no username/password being provided so it cannot connect to the DB server. Adding it to the test step solves the problem:
- name: Run tests
run: bundle exec rake
env:
RAILS_ENV: test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
Related Topics
Finding the Element of a Ruby Array with the Maximum Value for a Particular Attribute
Put a Link in a Flash[:Notice]
In Ruby on Rails, After Send_File Method Delete the File from Server
How to Reference a Function in Ruby
Couldn't Require Openssl in Ruby
How to Know When to "Refresh" My Model Object in Rails
Guard with Rspec on Rails 4 Giving a Lot of Warnings
How to Run a Ruby Script Using Rbenv with Cron
Size, Length and Count in Rails
Creating a Model That Has a Tree Structure
Ruby on Rails: How to Run Things in the Background
Removing All Empty Elements from a Hash/Yaml
How to Get Haml to Work with Rails
In Ruby's Test::Unit::Testcase, How to Override the Initialize Method
How to Pass a Parameter for Gem Installation When I Run Bundle Install
How to Get Readline Support in Irb Using Rvm on Ubuntu 11.10