FATAL: password authentication failed for user "postgres" when using non-default password
See original GitHub issueDescription
When trying to connect to Postgres with standard postgres
user which has non-default (not postgres
) password, error is thrown:
FATAL: password authentication failed for user "postgres"
Command I use:
pgcli --host localhost --port 5431 --dbname metabot --username postgres
--password
argument does nothing (password prompt isn’t shown either). Similar psql
command (psql --host localhost --port 5431 --dbname metabot --username postgres
) works without issues and shows password prompt. Installed pgcli
via pip
(v2.0.2). When installing with sudo apt install pgcli
, it installs v1.6.0, and this version works well (shows password prompt and logs in after inputting the password). Tried to dump pgcli
with config folder and reinstall but nothing changes.
Your environment
Ubuntu 18.04, pgcli v2.0.2
pip freeze
output:
asn1crypto==0.24.0
audioread==2.1.5
backports.csv==1.0.6
beautifulsoup4==4.6.0
certifi==2018.1.18
chardet==3.0.4
cli-helpers==1.1.0
Click==7.0
colorama==0.3.7
configobj==5.0.6
cryptography==2.1.4
decorator==4.1.2
enum34==1.1.6
html5lib==0.999999999
humanize==0.5.1
idna==2.6
ipaddress==1.0.17
keyring==10.6.0
keyrings.alt==3.0
lxml==4.2.1
mutagen==1.38
mysqlclient==1.3.10
numpy==1.13.3
pathlib2==2.3.0
pgspecial==1.11.5
pick-colour-picker==1.0
prompt-toolkit==2.0.9
psutil==5.4.2
psycopg2==2.7.7
puddletag==1.2.0
pyacoustid==1.1.2
pycairo==1.16.2
pycrypto==2.6.1
Pygments==2.3.1
pygobject==3.26.1
pymad==0.10
pyOpenSSL==17.5.0
pyparsing==2.2.0
python-apt==1.6.3+ubuntu1
python-Levenshtein==0.12.0
pyxdg==0.25
requests==2.18.4
scandir==1.7
scour==0.36
SecretStorage==2.3.1
setproctitle==1.1.10
six==1.12.0
sqlparse==0.2.4
tabulate==0.8.3
terminaltables==3.1.0
urllib3==1.22
wcwidth==0.1.7
webencodings==0.5
wxPython==3.0.2.0
wxPython-common==3.0.2.0
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
FATAL: password authentication failed for user "postgres ...
The default authentication mode for PostgreSQL is set to ident. You can access your pgpass.conf via pgAdmin -> Files -> open pgpass.conf.
Read more >How to fix an error: password authentication failed for the user ...
... the user in PostgreSQL. I have two solutions for this Error. First solution : open Terminal and write this command in terminal....
Read more >Postgresql – Getting authentication failed error with ... - iTecNote
When i try to login from command line like this psql -h dbserver -U testuser test. then i get this error psql: FATAL:...
Read more >Getting Started with PostgreSQL
Enter the CURRENT SUPERUSER password for sudo. psql (10.6 (Ubuntu 10.6-0ubuntu0.18.04.1)) Type "help" for help. postgres=# help You are using psql, ...
Read more >15: 21.15. Authentication Problems - PostgreSQL
Authentication failures and related problems generally manifest themselves through error messages ... FATAL: password authentication failed for user "andym".
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@quezak I have a theory. It is possible, if you are using keyring, that default password for
postgres
was previously stored there. Now you have changed it, the stored password is not correct anymore, butpgcli
is not asking you for password because it only asks if you did not provide one, and you provided one via keyring:https://github.com/dbcli/pgcli/blob/1c66dece59d4595eee3fb33d2609e2e288a28ff4/pgcli/main.py#L459-L463
Here is how you can confirm (or disprove) the theory:
Do you see an incorrect stored password?
If yes, the quickest fix is either updating it in keyring:
or disabling keyring in
~/.config/pgcli/config
.This command below worked for me
psql -h localhost -U postgres -p 5433 … postgres=# \du