<p>Sorry, this is totally a PostgreSQL setup issue and nothing at all to do with <code>db-sync</code>. You might get some more information by running:</p>
<pre><code>PGPASSFILE=config/pgpass-mainnet scripts/postgresql-setup.sh --check
</code></pre>
<p>If that doesn't give you any clues I would read up on user authentication in the PostgreSQL documentation.</p>

CC BY-SA 4.0
2022-03-25T04:34:18.153Z
ok ty I will look into this
noone392
CC BY-SA 4.0
2022-03-25T04:07:57.287Z
2022-03-25T04:07:57.287Z
Erik de Castro Lopo
<p>Trying to get db sync to do the initial database setup. I have this running on another ubuntu 20 box, and I trying to recreate it from scratch with all of the same versions and this time I am getting an error trying to run it</p>
<pre><code>Running : migration-1-0000-20190730.sql
psql: error: fe_sendauth: no password supplied
ExitFailure 2
</code></pre>
<p>i know that it seems the pgpass file because when I run</p>
<pre><code>PGPASSFILE=config/pgpass-mainnet scripts/postgresql-setup.sh --createdb
</code></pre>
<p>It recognizes the username I put in there. And the password is in there as well
Here is the db sync command I am running:</p>
<pre><code>PGPASSFILE=/home/user/cardano-db-sync/config/pgpass-mainnet \
  /home/user/cardano-db-sync/db-sync-node/bin/cardano-db-sync \
      --config /home/user/cardano-db-sync/config/mainnet-config.yaml \
      --socket-path /var/ada/node.socket \
      --state-dir /home/user/cardano-db-sync/ledger-state/mainnet \
      --schema-dir /home/user/cardano-db-sync/schema/ \
</code></pre>
<p>which results in the following response</p>
<pre><code>[db-sync-node:Info:6] [2022-03-25 03:22:50.40 UTC] Schema migration files validated
[db-sync-node:Info:6] [2022-03-25 03:22:50.40 UTC] Running database migrations
[db-sync-node:Info:6] [2022-03-25 03:22:50.40 UTC] Enviroment variable DbSyncAbortOnPanic: False
ExitFailure 2

Errors in file: /tmp/migrate-2022-03-25T032250.log
</code></pre>
<p>and the log file is what contains the authentication error.. my pgpass looks like</p>
<pre><code>/var/run/postgresql:5432:cexplorer:username:'userpass'
</code></pre>
<p>I have also tried using localhost and 127.0.0.1. I notice when running</p>
<pre><code>PGPASSFILE=config/pgpass-mainnet psql cexplorer
</code></pre>
<p>it asks me to authenticate for my current user, NOT the user in the mgpass file but when running the previous command for creating db it asks me the password for the correct user in the pgpass file. Both users can log into postgres regardless and actually have the same password at the moment. Any clues would be appreciated this is with cradno-db-sync 12.0.2 the latest node release.</p>

<cardano-db-sync>
cardano db-sync won't authenticate to postgres?
# cardano db-sync won't authenticate to postgres?

(Asked by: username_0 on 2022-03-25)

Trying to get db sync to do the initial database setup. I have this running on another ubuntu 20 box, and I trying to recreate it from scratch with all of the same versions and this time I am getting an error trying to run it
Running : migration-1-0000-20190730.sql
psql: error: fe_sendauth: no password supplied
ExitFailure 2

i know that it seems the pgpass file because when I run
PGPASSFILE=config/pgpass-mainnet scripts/postgresql-setup.sh --createdb

It recognizes the username I put in there. And the password is in there as well
Here is the db sync command I am running:
PGPASSFILE=/home/user/cardano-db-sync/config/pgpass-mainnet \
  /home/user/cardano-db-sync/db-sync-node/bin/cardano-db-sync \
      --config /home/user/cardano-db-sync/config/mainnet-config.yaml \
      --socket-path /var/ada/node.socket \
      --state-dir /home/user/cardano-db-sync/ledger-state/mainnet \
      --schema-dir /home/user/cardano-db-sync/schema/ \

which results in the following response
[db-sync-node:Info:6] [2022-03-25 03:22:50.40 UTC] Schema migration files validated
[db-sync-node:Info:6] [2022-03-25 03:22:50.40 UTC] Running database migrations
[db-sync-node:Info:6] [2022-03-25 03:22:50.40 UTC] Enviroment variable DbSyncAbortOnPanic: False
ExitFailure 2

Errors in file: /tmp/migrate-2022-03-25T032250.log

and the log file is what contains the authentication error.. my pgpass looks like
/var/run/postgresql:5432:cexplorer:username:'userpass'

I have also tried using localhost and 127.0.0.1. I notice when running
PGPASSFILE=config/pgpass-mainnet psql cexplorer

it asks me to authenticate for my current user, NOT the user in the mgpass file but when running the previous command for creating db it asks me the password for the correct user in the pgpass file. Both users can log into postgres regardless and actually have the same password at the moment. Any clues would be appreciated this is with cradno-db-sync 12.0.2 the latest node release.

**Tags:** cardano-db-sync

---

## 1 answers

### Answer by username_1 on 2022-03-25. Score: 1

Sorry, this is totally a PostgreSQL setup issue and nothing at all to do with db-sync. You might get some more information by running:
PGPASSFILE=config/pgpass-mainnet scripts/postgresql-setup.sh --check

If that doesn't give you any clues I would read up on user authentication in the PostgreSQL documentation.

> **Comments:**
> **username_0**: ok ty I will look into this  

---

