Getting:
An error has occurred:
Error connecting to the server: fe_sendauth: no password supplied
Settings in database.yml
are the same as the app setup on other machines.
How can I set things up so that I don't need a password hardcoded?
I can view the db ok using PgAdmin-III.
I'd rather not have the password in database.yml
as other machines using this app don't have/need it, so it seems likely to be something about my Pg install.
@rodrigo-zurek was spot on; you have to change the
pg_hba.conf
. Just want to add this answer for the OSX users because thepg_hba.conf
is located in a different place by default.The default will have
md5
in the columnMETHOD
, but replace all of those withtrust
:Then, open up pgAdmin III inside your Applications/PostgreSQL 9.X, right click the database (e.g.
PostgreSQL 9.4 (localhost)
), and clickReload Configuration
. After this, I was able torake db:create
.You need to change your change your
pg_hba.conf
. Here's an example of mine:pg_hba.conf
:Note that
trust
means that anyone onaddress
(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.No password supplied means you have set it up to require password authentication and no password is being supplied. Here is documentation for 9.0: http://www.postgresql.org/docs/9.0/static/auth-methods.html
Keep in mind that local auth was changed from "ident" to "peer" in 9.1 to avoid confusion. See the 9.1 docs at http://www.postgresql.org/docs/9.1/static/auth-methods.html
Also keep in mind that this is an ordered rule set with first match governing. Furthermore local and localhost are different. Local is for local UNIX domain socket connections, while host localhost would be for network connections to localhost. So it sounds like you have some troubleshooting to do but hopefully the docs should help.