Score:0

"Unable to connect to server: connection failed: FATAL: password authentication failed" on brandly installed postgres and PGAdmin4

in flag

I want to create a new server and a new postgres database from the PGAdmin4 UI just-installed on Ubuntu 22.04

I already did this before but I don't remember how did I do id.

The server I created last time had these credentials:

name
postgres-local

username
postgres

pw
postgres

hostanme / address
127.0.0.1

port
5432

server group
Servers

I want to keep these credentials because I have this database to be used by some legacy application.

So I installed postgresql and then PGAdmin4 on Ubuntu by doing

postgres

sudo apt install postgresql postgresql-contrib -y

PGAdmin4

By following this article, I have run

curl  -fsSL https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/pgadmin.gpg

sudo sh -c 'echo "deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list'

cat /etc/apt/sources.list.d/pgadmin4.list

sudo apt update
sudo apt install pgadmin4

systemctl status apache2

sudo /usr/pgadmin4/bin/setup-web.sh

sudo ufw allow http
sudo ufw allow https

Now I open PGAdmin4 on

http://localhost/pgadmin4/browser/

and there is no server available. So I tried to add one, with the configurations written upwards.

but as I try to save the configurations and create the db, this message pops up

Unable to connect to server: connection failed: FATAL: password authentication failed for user "postgres" connection server at "127.0.0.1", port 5432 failed: FATAL: password authentication failed for user "postgres".

what am I doing wrong?

enter image description here

Score:0
in flag

Solved by launching these commands in my Ubuntu terminal

# become the postgres user
sudo -i -u postgres

# open the postgres shell
psql

# create a void database with the name I want
create database "postgres-local";

# give privileges to the already-existing user postgres to access that database
grant all privileges on database "postgres-local" to postgres;

# set the password 'postgres' to user  'postgres'
ALTER USER postgres WITH PASSWORD 'postgres';
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.