error: password authentication failed for user "myuser"

Mathieu Bertin

If I have a record in /etc/postgresql/9.4/main/pg_hba.conf which specifically trusts my specific user

# TYPE  DATABASE        USER            ADDRESS                 METHOD
local   all             myuser                                trust

Since I'm on debian I restart postgresql like this

sudo /etc/init.d/postgresql restart

Here is my entire source file testing this out:

const pg = require('pg');
const connectionString = "postgres://myuser:mypassword@localhost/mydbname";

const client = new pg.Client(connectionString);
client.connect();
const query = client.query('SELECT * FROM USERS');
query.on('end', () => { client.end(); });

and this is the error I consistently get:

error: password authentication failed for user "myuser"
    at Connection.parseE (/home/myuser/webserver/node_modules/pg/lib/connection.js:539:11)
    at Connection.parseMessage (/home/myuser/webserver/node_modules/pg/lib/connection.js:366:17)
    at Socket.<anonymous> (/home/myuser/webserver/node_modules/pg/lib/connection.js:105:22)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at Socket.Readable.push (_stream_readable.js:134:10)
    at TCP.onread (net.js:551:20)

It's also worth noting that doing the following works:

psql -h localhost -U myuser mydb

What am I doing wrong here?

Laurenz Albe

As the documentation states, local is only for UNIX socket connections, while you are establishing a TCP connection to localhost.

Use a line like this:

host    all    myuser    127.0.0.1/32    trust

to trust all connections from localhost using IPv4 (use the adress ::1/128 for IPv6).

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

error: error: password authentication failed for user "electron_release_server_user"

From Java

Postgresql: password authentication failed for user "postgres"

From Dev

FATAL: password authentication failed for user "postgres"

From Dev

PSQL - password authentication failed for user "postgres"

From Dev

jitterbit-password authentication failed for user "postgres"

From Dev

Password authentication failed for a user not in my role list

From Dev

error: Ident authentication failed for user

From Dev

Ecto Postgres install error password authentication failed

From Dev

psql: FATAL: password authentication failed for user error while trying to access psql

From Dev

PostgreSQL SSPI authentication - FATAL: 2801: password authentication failed for user "xxx"

From Dev

28P01--Password authentication failed for user in DataGrip

From Java

FATAL: password authentication failed for user "postgres" (postgresql 11 with pgAdmin 4)

From Dev

psql: FATAL: password authentication failed for user windows 8

From Dev

PG::ConnectionBad: FATAL: password authentication failed for user "alphauser"

From Dev

Redshift connection issue: FATAL: password authentication failed for user

From Dev

FATAL: password authentication failed for user "postgres" Ubuntu v20.10

From Dev

Java Springboot application returning password authentication failed for user "postgres"

From Dev

Authentication failed for user: null

From Dev

Authentication failed for user: null

From Dev

PostgreSQL password authentication failed for user "postgres", not the same user as specified in my app config

From Dev

Rails 5 in prod: PG::ConnectionBad: FATAL: password authentication failed for user "postgres" with Docker

From Dev

Payment with authorize.net gives error User authentication failed due to invalid authentication values

From Dev

Payflow reports "User authentication failed"

From Dev

Peer authentication failed for user "odoo"

From Dev

pg_dump password authentication failed error with pgpass.conf file in Windows

From Dev

remote: Invalid username or password, fatal: Authentication failed for

From Dev

heroku pg:pull password authentication failed

From Dev

error in linking phone authentication with email/password authentication

From Dev

What does this error mean? AH01215: Schema .myuser@mydb. Password .mypass

Related Related

  1. 1

    error: error: password authentication failed for user "electron_release_server_user"

  2. 2

    Postgresql: password authentication failed for user "postgres"

  3. 3

    FATAL: password authentication failed for user "postgres"

  4. 4

    PSQL - password authentication failed for user "postgres"

  5. 5

    jitterbit-password authentication failed for user "postgres"

  6. 6

    Password authentication failed for a user not in my role list

  7. 7

    error: Ident authentication failed for user

  8. 8

    Ecto Postgres install error password authentication failed

  9. 9

    psql: FATAL: password authentication failed for user error while trying to access psql

  10. 10

    PostgreSQL SSPI authentication - FATAL: 2801: password authentication failed for user "xxx"

  11. 11

    28P01--Password authentication failed for user in DataGrip

  12. 12

    FATAL: password authentication failed for user "postgres" (postgresql 11 with pgAdmin 4)

  13. 13

    psql: FATAL: password authentication failed for user windows 8

  14. 14

    PG::ConnectionBad: FATAL: password authentication failed for user "alphauser"

  15. 15

    Redshift connection issue: FATAL: password authentication failed for user

  16. 16

    FATAL: password authentication failed for user "postgres" Ubuntu v20.10

  17. 17

    Java Springboot application returning password authentication failed for user "postgres"

  18. 18

    Authentication failed for user: null

  19. 19

    Authentication failed for user: null

  20. 20

    PostgreSQL password authentication failed for user "postgres", not the same user as specified in my app config

  21. 21

    Rails 5 in prod: PG::ConnectionBad: FATAL: password authentication failed for user "postgres" with Docker

  22. 22

    Payment with authorize.net gives error User authentication failed due to invalid authentication values

  23. 23

    Payflow reports "User authentication failed"

  24. 24

    Peer authentication failed for user "odoo"

  25. 25

    pg_dump password authentication failed error with pgpass.conf file in Windows

  26. 26

    remote: Invalid username or password, fatal: Authentication failed for

  27. 27

    heroku pg:pull password authentication failed

  28. 28

    error in linking phone authentication with email/password authentication

  29. 29

    What does this error mean? AH01215: Schema .myuser@mydb. Password .mypass

HotTag

Archive