I have quite an exciting and bit frustrating situation.
Postgresql -server (on a desktop Ubuntu):
# I have successfully installed it
# I am trying to start the server but I am not seeing the terminal
# change from Kia@office ubuntu >> to the postgresql #
# Here is response for various codes:
kia@officeUbuntu:~$ sudo systemctl start postgresql
kia@officeUbuntu:~$ psql
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: role "manju_fsec_ems" does not exist
kia@officeUbuntu:~$
kia@officeUbuntu:~$ pg_lsclusters
Ver Cluster Port Status Owner Data directory Log file
14 main 5432 online postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
15 main 5433 online postgres /var/lib/postgresql/15/main /var/log/postgresql/postgresql-15-main.log
Postgresql-Client (on a raspberry Pi):
pi@raspberrypi:~ $ psql --host 10.173.65.37 --username postgres --password
Password:
psql (13.9 (Raspbian 13.9-0+deb11u1), server 14.7 (Ubuntu 14.7-1.pgdg22.04+1))
WARNING: psql major version 13, server major version 14.
Some psql features might not work.
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)
Type "help" for help.
postgres=# \dt
Did not find any relations. # This means there are no tables in the database yet
# Above response implies that we are able to establish remote connection with the postgresql server. Also, terminal `pi@raspberry:` changed to the `postgres=#`
My question: As you can see above, I am not able to active and enter inside the Postgresql server on the very computer it is installed but I am able to make a successful remote connection from another Raspberry pi device. This is atleast a good news for me but not able to activate Postgresql on the server itself is troubling me. I don't know why? I have seen many Q&A with same situation. I tried few but did not work.
Update: Based on the @Zac Anger comment below:
kia@MMofficeUbuntu:~$ sudo -u postgres -i
[sudo] password for kia:
postgres@MMofficeUbuntu:~$ \dt
dt: command not found
postgres@MMofficeUbuntu:~$ psql
psql (15.2 (Ubuntu 15.2-1.pgdg22.04+1), server 14.7 (Ubuntu 14.7-1.pgdg22.04+1))
Type "help" for help.
postgres=# \dt
Did not find any relations.
postgres=#