I know there are thousands of questsions like this one here on SO but i've seen them all and i'm still not able to deal with my problem.
I'm doing everything using ansible so it's quite automated but, anyway, here are my files:
local all all trust
host all all 127.0.0.1/32 md5
host all all ::1/128 md5
host all all 10.11.12.0/24 md5
production:
database: my_db
adapter: postgresql
host: localhost
username: deploy
encoding: unicode
min_messages: WARNING
template: template0
And i have a deploy
user (and postgres user without a password set) in my system created. And now, while i'm totally able to sign in to postgres from bash using psql -d my_db
(on server), i'm not able to connect to the db with my rails app. Running rake db:migrateMigration gives me
PG::ConnectionBad: fe_sendauth: no password supplied
I'm quite terrible at beeing a devop and i'm fighting with that issue from the day before yesterday's morning and it's still here so if there is anyone who can help me with that, i would be be more than grateful.
Edit the pg_dba. conf file and change all local connections from md5 to trust. By doing this, you can log in to the PostgreSQL database server without using a password. The "C:\Program Files\PostgreSQL\12\data" is the data directory.
For most systems, the default Postgres user is postgres and a password is not required for authentication. Thus, to add a password, we must first login and connect as the postgres user.
PostgreSQL database passwords are separate from operating system user passwords. The password for each database user is stored in the pg_authid system catalog. Passwords can be managed with the SQL commands CREATE ROLE and ALTER ROLE, e.g., CREATE ROLE foo WITH LOGIN PASSWORD 'secret' , or the psql command \password .
psql is using a local socket connection, rails is using localhost over TCP/IP. Local is trusted, localhost requires a password (using md5). You could setup a pgpass file for your rails user: http://www.postgresql.org/docs/current/static/libpq-pgpass.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With