Issue while installing postgresql, pgsql in ubuntu 16.04 - postgresql

I have tried to install Postgres in my ubuntu system, but facing issues from last 2 days.
Issue something related to port 5432
Error:-
10 main 5432 down postgres /var/lib/postgresql/10/main/ /var/log/postgresql/postgresql-10-main.log
Error Image

Related

Upgrading postgresql v9.4 to v12 but get pg_upgrade: command not found

I'm on Ubuntu 20.04 and currently running my app on postgresql 9.4.
I installed postgres version 12 and I'm trying to migrate my data over from postgres v9.4 to postgres v12. I also have postgres version 11 installed from an earlier time.
I'm trying to do this from pg_upgrade
So when I run pg_lsclusters I get:
9.4 main 5432 online postgres /var/lib/postgresql/9.4/main /var/log/postgresql/postgresql-9.4-main.log
11 main 5433 down postgres /var/lib/postgresql/11/main /var/log/postgresql/postgresql-11-main.log
12 main 5434 down postgres /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log
When change to the postgres user (from the root) and run pg_upgrade --check I get:
pg_upgrade: command not found
Where is it looking for the pg_upgrade file/command?

pgadmin4 can't connect to postgresql 14

I've installed postgresql 14 and pgadmin4 on Ubuntu 20.04. I set a password with sudo passwd postgres and restarted postgresql I've modified the METHOD settings in /etc/postgresql/14/main/pg_hba.conf to be trust. But pgadmin4 refuses to connect with this message:
This used to be all it took to get pgadmin4 to connect.
Is there something new in Postgresql 14 that has to be done?
Thank you, I was going crazy trying to resolve this issue for the last 3 days until I hit this post.
I recently installed PostgreSQL 14 on Ubuntu 20.04 and was trying pgAdmin 4 v. 6.7 and was not able to even create a server without having an INTERNAL SERVER ERROR message. The issue was that when installing PostgreSQL I simply used the same Linux root user password and did not specify a password for the postgres user as you mentioned in the line:
psql -c "ALTER USER postgres WITH PASSWORD 'secure_password_here';"
Thank you

psql could not connect to server after complete reinstallation [Ubuntu 21.10 / PostgreSQL 13]

After experiencing issues related to the existence of two different PostgreSQL versions installed on the same machine, I decided to remove --purge postgresql* and reinstall postgresql-13. Now the output of psql --version is psql (PostgreSQL) 13.4 (Ubuntu 13.4-1).
However, trying to enter psql, I have this error:
psql: error: could not connect to server: Aucun fichier ou dossier de ce type
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
I tried the several solutions proposed on similar posts but none solved my issue.
Edit : output of pg_lsclusters is
Ver Cluster Port Status Owner Data directory Log file
12 main 5432 down,binaries_missing postgres /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log
13 main 5433 online postgres /var/lib/postgresql/13/main /var/log/postgresql/postgresql-13-main.log

Connect to a older Postgresql database

I have PostgreSQL installed in my Linux machine, I'm following a old YT tutorial for work and the instructor is using PostgreSQL 11. I have already used the following command:
sudo apt-get -y install postgresql-11
To install PostgreSQL 11 in my machine, how do I connect to this specific version and not version 12?
Postgress configuration files are located at:
/etc/postgresql/##/main/postgresql.conf
Use your favorite code editor and navigate to the CONNECTIONS AND AUTHENTICATION this will reveal at which port the Postgress database is listening.
Connect to you desired version using the -p flag. For me Postgres 11 is using port 5433 and Postgres 12 is using 5432.
psql -h 5433 postgress
Check your version using
SHOW version();
Expected output
version
----------------------------------------------------------------------------------------------------------------------------
PostgreSQL 11.9 (Ubuntu 11.9-1.pgdg20.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0, 64-bit
(1 row)
The 2nd installed version is probably running on port 5433 rather than 5432.
But rather than guessing, you can run pg_lsclusters and see. Then specify that port number whereever you need to connect.

Parallel versions in PostgreSQL, What do I actually use?

Os - ubuntu 18.04 (bionic)
I have installed postgresql 10 some time ago, and today i install a new version, 12.
I don't mind to throw all the previous data, so i tried to do pg_ctl stop for the old server. I am not able to execute the pg_ctl stop for the old server, because the command not found.
I found where postgres is installed, under /var/lib/postgres and it has two folders, one is 10 and the other is 12. I tried to call pg_ctl from 10/main but it does not appear also there. there is no bin folder there as well.
When I type psql under the postgres user, i get this info:
psql (12.2 (Ubuntu 12.2-2.pgdg18.04+1), server 10.12 (Ubuntu 10.12-0ubuntu0.18.04.1))
I have search for hours in the docs and on the web, but i didn't find info for that.
Can you help me understand what is going on in my machine?
Edit: pg_lsclusters output:
Ver Cluster Port Status Owner Data directory Log file
10 main 5432 online postgres /var/lib/postgresql/10/main /var/log/postgresql/postgresql-10-main.log
12 main 5433 online postgres /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log
also, i can no longer connect to the new port. I have try to connect to port 5433 with postgres user and my password ( I have changed the pg_hba.conf row to authenticate with md5), but it didn't work.