Oztro
Oztro

Reputation: 86

Error "psql: fe_sendauth: no password supplied" at connect sublime text with postgres in JSON

I try to query since sublime to my database but I can not send the password of DB.

sql.sublime-build:

{
    "cmd": ["psql", "-U","user", "-d","my_database" ,"-o","final.txt","-a", "-E", "-f","$file" ]
}

I tryed adding "-W","MyKey" or "-w" but not run

Upvotes: 2

Views: 3851

Answers (1)

Craig Ringer
Craig Ringer

Reputation: 324541

Per the documentation, you should use a .pgpass file, or if you must, the PGPASSWORD environment variable.

-w tells psql "never prompt for a password".

-W is "always prompt for a password".

There is no "here is the password" command line option.

Presumably sublime text offers a way to set environment variables on command invocations.

Another option, especially if on a development machine, is to tweak pg_hba.conf so no password is required for the connection in the first place. Again, see the documentation for details.

Upvotes: 8

Related Questions