i ran some error today with my postgresql maybe someone can help. I install Postgresql in windows server. I connect using PgAdmin. Usually i just enter my master password, then the next step i enter password for user 'postgres' to connect the my existing server. But today, after i enter password for user 'postgres', it said error FATAL : database "postgres"does not exist. I'll attach the error.
Yesterday is fine. But today got this error. I didn't do anything yesterday to the server. How to solved it ? Need Help. Thank you.
1 Answer 1
If the database postgres
suddenly doesn't exist, someone must have dropped it. If there is anybody with access to your system who is clueless or malicious enough to do such things, you are in trouble. Who knows what other harm these people did?
You can connect to the template1
database instead. With pgAdmin, you'd have to edit the connection properties and change the "maintenance database" accordingly. When you are connected, create a postgres
database again and change the connection settings back.
-
i tried connect to template1, but password authentication is failed. I thought the password for template1 should be same with user postgres.Daily Food ASMR– Daily Food ASMR2024年09月05日 06:21:42 +00:00Commented Sep 5, 2024 at 6:21
-
Right, the password of the user is independent of the database. Use the correct password. Perhaps whoever dropped the database also changed the password? It may be the best thing to wipe out the database (and perhaps the whole machine) and restore a good backup on a safer system.Laurenz Albe– Laurenz Albe2024年09月05日 06:28:56 +00:00Commented Sep 5, 2024 at 6:28
-
oke Thank You for your advise.Daily Food ASMR– Daily Food ASMR2024年09月05日 06:40:25 +00:00Commented Sep 5, 2024 at 6:40
psql
tool and provide an explicit database name! Also, it's best practice to not use thepostgres
db for ordinary work!