Janik Vonrotz


1 min read

Postgres connection URI password fails

With the psql command line tool you can either pass the connection credentials as parameters or simply as one connection string.

The general form for a connection URI is:

postgresql://\[user\[:password\]@\]\[host\]\[:port\]\[,...\]\[/dbname\]\[?param1=value1&...\]

While developing an Odoo module I could no longer execute queries using connections URIs. I always got the error psql: error: FATAL: password authentication failed for user "odoo".

Recently, I switched from MacOS to an Ubuntu-based system. That might be a cause for this behaviour. In this case I simply had to specify the port in the URI explictly.

➜  Odoo-Development git:(14.0) ✗ psql postgres://odoo:odoo@localhost/odoo
psql: error: FATAL:  password authentication failed for user "odoo"
FATAL:  password authentication failed for user "odoo"

➜  Odoo-Development git:(14.0) ✗ psql postgres://odoo:odoo@localhost:5432/odoo
psql (12.6 (Ubuntu 12.6-0ubuntu0.20.10.1), server 12.5 (Debian 12.5-1.pgdg100+1))
Type "help" for help.

odoo=#

Categories: Software development
Tags: psql , postgres
Improve this page
Show statistic for this page