Home > Mobile >  psql: error: FATAL: database "businesslogic" does not exist
psql: error: FATAL: database "businesslogic" does not exist

Time:12-24

This is my first question here so please bear with me for a while. I created two postgres users named 'keyloak' and 'businesslogic' with databases named 'keycloak' and 'sumo' respectively. Both users have the same password. After having built the image and run the docker container, I tried to login to each user in the bash terminal with the following commands:

psql -h localhost -U keycloak

psql -h localhost -U businesslogic

I could login to keycloak after having entered the password but could not do so for businesslogic. I got the following error,

psql: error: FATAL: database "businesslogic" does not exist

After logging into user 'keycloak' I could see, using commands \du and \l, that the two users and the two databases were created. But for some reason I cannot login to user 'businesslogic'. I don't know where I have gone wrong.

I would be glad if anyone can shed some light on this issue. I looked through other similar questions but could not find anything helpful.

If you need further information I will be happy to provide it.

I am sorry I had to delete the code details because of confidentiality reasons. It seems both the user name and the database name have to be the same in order for me to login. I set the database name to be the same as the user name and now I am able to login. It seems pretty strange why that might be the case.

As always any help would be very much appreciated.

CodePudding user response:

Try:

psql -h localhost -d sumo -U businesslogic.

This error:

psql: error: FATAL: database "businesslogic" does not exist

occurred because you did:

psql -h localhost -U businesslogic.

In the absence of an explicit database name (-d sumo) psql will default to using the user name businesslogic as the database name and as the error said there is no such name.

See Key words for more information.

  • Related