7

sup guys! I'm trying to create a server local in pdAdmin 4, but everytime i'm trying to create i get this error:

[Error in pgAdmin]

1

in case 'veterano' its my username...

my tries to make this run (but doesnt work)

Checking if Postgres Service is Installed correctly:

$ sudo systemctl is-active postgresql terminal back: active

$ sudo systemctl is-enabled postgresql terminal back: enabled

$ sudo systemctl status postgresql terminal back: active (exited)

$ sudo pg_isready terminal back: /var/run/postgresql:5433 - accepting connections

My configuration to pg_hba.conf :

local   all             postgres                                peer

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     peer
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
# IPv6 local connections:
host    all             all             ::1/128                 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
local   replication     all                                     peer
host    replication     all             127.0.0.1/32            md5
host    replication     all             ::1/128                 md5

(every time after change something in pg_hba.conf I run $ sudo systemctl restart postgresql to restart postgress service.)

Checking psql and the new superusers: $ sudo -u postgres createuser -s $USER

terminal back createuser: error: creation of new role failed: ERROR: role "veterano" already exists if I try psql -U veterano i can login... so i try \du to check list of roles terminal back

                                    List of roles
  Role name  |                         Attributes                         | Member of 
-------------+------------------------------------------------------------+-----------
 postgres    | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
 veterano    | Superuser, Create role, Create DB                          | {}

So I try create a localhost server in terminal: $ psql -h localhost -d mydatabase -U veterano -p 5432

terminal back: Password for user veterano:

(I put my password maked with ALTER USER veterano PASSWORD 'newPassword';)

terminal back error psql: error: FATAL: password authentication failed for user "veterano"

I really don't know what to do... I tried everything and still cant create a local server in pgAdmin 4 or directly in terminal.

Using Ubuntu 20.04.2 LTS

(Sorry for my english )

6
  • The only I can say is that the password you are entering is not the password you created for user veterano. Login in again using peer authentication; psql -U veterano and do the ALTER USER veterano PASSWORD 'newPassword' again to make sure you have the correct password set up. Also are you sure you have only one Postgres cluster running? Where did you install Postgres from the Ubuntu or Postgres repos? Commented May 17, 2021 at 15:15
  • Look in the log file for the full ERROR message. Unauthenticated users are not given all the info which the system has. Commented May 17, 2021 at 16:24
  • I install postgres using this tutorial maked for "Grogu" stackoverflow.com/questions/53267642/… I try again login using peer authentication and ALTER USER veterano PASSWORD 'newPassword' and still get error password authentication for "veterano" Commented May 17, 2021 at 17:17
  • 1
    FIX IT! I was already using port 5432 with a docker, it was just a port conflict, I disconnected the docker and finally I got it, very strange that he did not specify the error as a port conflict! Thanks all! Commented May 17, 2021 at 18:48
  • 1
    There was no port conflict. You did not specify a port when connecting so psql used the default of 5432 and connected you to the docker server which did not have the user/password combo you where supplying. Commented May 17, 2021 at 19:59

4 Answers 4

14

This is probably too late. but I have the same issue with veterano, and what I did was to change the password for the account "postgres" that I have : (For those who don't know, postgresql has a user named "postgres" by default after installation)

Steps: Access PSQL

$ sudo su - postgres

Then try to change the password for "postgres" user by typing :

postgres=# \password

You can then specify any password you want for this account. Once thats done, you can use pgAdmin to connect using "postgres" username and the password that you just set.

Sign up to request clarification or add additional context in comments.

1 Comment

This does not solve the problem of unauthenticated, but instead you're using the postgres super user by setting it a password.
4

Either you didn't set a password for the user, or you set a different password.

Connect using psql with psql -U veterano and set the password:

veterano=> \password
Enter new password: 
Enter it again:

Now you should be good.

3 Comments

Still psql: error: FATAL: password authentication failed for user "veterano"
But that's the only possibility, unless you connected to the wrong port (where a different cluster is running) or localhost resolves to something else than you think.
I can add other servers but not localhost, I really don't know why this happening to me
0

Try putting quotation marks '' on your password at your config file.

Comments

0
  1. First we have to get inside postgres through using

    sudo -u postgres psql postgres

  2. Enter password for user postgres

Now the terminal will be like this:

postgres=#

  1. Now enter the given line after postgres=# CREATE USER username WITH PASSWORD 'your password'; (put your password inside quotes('') and don't forget semicolon(;)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.