On my Ubuntu machine, I have installed postgres 15. I created a new superuser called "test" (with password "test"). Then, I created a database called "test" as well and granted all privileges to the user test. Here the sequence of steps I made:
# Create a new user on Ubuntu sudo adduser test # Create the user test on postgres sudo -u postgres psql postgres; CREATE USER test SUPERUSER; ALTER USER test WITH PASSWORD 'test'; exit; # Login with test to create the DB and being the owner of the DB sudo -u test psql postgres; CREATE DATABASE test; GRANT ALL PRIVILEGES ON DATABASE test TO test; exit;
From psql, when I try the following I can successfully connect:
psql -d test -U test
However, If I try:
I get: psql: error: connection to server at "localhost" (127.0.0.1), port 5432 failed: FATAL: password authentication failed for user "test"