Score:1

How access db postgres with other user

sd flag

I'm new to postgres.

I created a postgres docker container; when I access through the command "psql -U postgres" I access regularly and the prompt becomes like this: postgres=#.

(At the moment I have not created a database I have left the default one)

I created some superuser accounts, and in fact when I type \du, they appear in the table.

So far no problem.....

Now I would like to log in as one of these created users so I exit and go back to "root@@0c23b98444fc".

What's the problem?

When I try to access one of these users (with the psql -U kate command), I get the error:

" psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: database "kate" does not exist.

I don't understand why the users were created regularly and I don't understand why the postgres user lets me log in while the others don't.

I hope for some help

Score:0
br flag

you need to create database for kate or log in to default database with kate user.

example: psql -U kate postgres => to login to postgres database with kate user.

alternatively, create default database for kate:

psql -U postgres
CREATE DATABASE kate OWNER kate;
GRANT ALL PRIVILEGES on DATABASE kate to kate;

then next time you can login with psql -U kate

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.