FATAL: password authentication failed for user postgres [SQL State=28P01] - postgresql

So I'm using postgresql 13 and SQL Workbench on Windows 10 for the first time. I'm trying to connect the database to the server to no avail. I keep getting this error message: FATAL: password authentication failed for user postgres [SQL State=28P01]. From Stack Overflow and other documentation, I'm able to gather things about older versions of postgres or how to address this issue in Ubuntu and/or from the command line. But I have yet to find a remedy that fits my specific circumstance. Anyone have tips on how I can fix this or even better search terms that point towards a more precise solution? Let me know. Thanks!

Related

Troubleshoot org.postgresql.util.PSQLException: Connection attempt timed out that only occasionally happens

I have several applications running on tomcat with a local PostgresSQL database. And tomcat occasionally reports the following errors:
org.postgresql.util.PSQLException: Connection attempt timed out.
I am able to connect to the database using other tools such as DBeaver. And this problem looks only happens when several applications are connecting to the database. So I want to know how to troubleshoot this issue. Is there any log in PostgresSQL that I can check?
PostgreSQL does have logging. It is very configurable, and we can't tell you how you have it configured. Common locations are /var/log/postgresql/, and in PGDATA/log/. However, a connection timeout will probably not be in the postgresql log as it probably never achieved contact with the postgresql server to start with.

Error trying to connect to mongolab from cdm: Error: 18 authentication fail

I'm getting this error when I try to connect to my mongolab DB.
I saw some different topics talking about this issue, but solutions they gave was:
-Add mongoDB exception in my firewall. I done it without result
-Check if I was using the mongolab.com user and password instead of the user database. That's not the problem, even I created new users.
-Check if my version of mongoDB was older than the version used by mongolab (3.x). I also specified the auth system in the command to be sure.
I tried all those answers without success. I also checked the connection with the server, and it neither was the problem. I'm going crazy.
What could be the issue?
Thanks for your attention!
It was finally a network problem. I was lucky to discover it, cause I lost many hours.

FATAL: no pg_hba.conf entry for host” but I can connect trough pgAdmin

Update: It seems to be problem with ElephantSQL, the service I'm using according to this
However, I dont know where to add this.
Exact error:
FATAL: 28000: no pg_hba.conf entry for host "host", user "username", database "template1", SSL off
Similar error to this problem. Even after adding SslMode=require, I still couldn't connect to the database.
<add name="DefaultConnection" connectionString="Server=serverip;Port=5432;Database=dbname;User Id=username;Password=pass;CommandTimeout=60;Preload Reader=True;"/>
Weird thing is that it tried to connect to template1 instead of database specified in the connection string.
Connecting through pgadmin is fine though.
It's because you're on a shared ElphantSQL plan and can only connect to your own database. Npgsql tries to connect to template1 for some reason when it's checking server version, creating new databases etc, ignoring the database name given in the connection string. We'll submit a bug report to Npgsql.
I am 4 years late to this party but had this issue with npgsql also and this question came up so hopefully this helps someone else in the same boat next time.
I was able to fix it by adding "EF Template Database=[MyDatabase]" to my connection string. The default for that value is "template1" according to npgsql documentation

Problems with postgres database in redmine after change in password

First, I'm a total newbie and I guess that's why this error occurred in the first place.
A colleague of mine stopped working and so I had to take over administrative stuff as the redmine we use and making backups.
So I wanted to schedule these backups automatically. Somewhere on the way I changed /etc/postgresql/9.1/main/pg_hba.conf for user postgres (that's the one for the redmine database.
from local all postgress peer to local all postgress trust so I could run a shell program in crontab. This worked but then redmine doesn't work anymore. I get this:
FATAL: password authentication failed for user "postgres" FATAL:
password authentication failed for user "postgres" (PG::Error)
On this the error site for redmine. I changed everything back and restarted everything, but it did't work.
Then I used an older backup to restore but still.
So, now I have no idea whats wrong. Maybe someone can help me.
Thanks.
Barbara
I think it is because I've changed the password of the postgres user in ubuntu. I did not know at the moment that they are connected. I always got a password promt but I didn't know it (my colleague at least didn't tell me one) I've tried to change it in the data base as well with
ALTER USER Postgres WITH PASSWORD 'newpassword';
Would it be enough to reinstall the database and use an old backup?

Postgres SSL error

I'm trying to run a Drupal migration via SSH and drush (a command line shell), copying data from a postgres database to mysql.
It works fine for a while (~5 mins or so), but then I get the error:
SQLSTATE[HY000]: General error: 7 SSL [error] SYSCALL error: EOF detected
The postgres database connection seems to have gone, and I just get errors:
SQLSTATE[HY000]: General error: 7 no [error] connection to the server
It works fine locally, so I think the problem must be with postgres and running a script over SSH - but googling these errors returns nothing useful. Does anyone know what could be causing this?
Could be a timeout. first inspect the log (maybe change ssl_renegotiation_limit)
BTW: IIRC, the renegotiation does not take place after a fixed amount of time, but after a certain amount of transmitted characters (2GB?)
You should check both your PostgreSQL and MySQL logs for further potential details. If there's not much in the PostgreSQL log, look at the log_min_error_statement in postgresql.conf. As you'll find through that link, you can tune it to increase the amount of logging. If there's still not clues in the PostgreSQL log, I would look at other components in your system for the problem.