What is the default username and password for PostgreSQL?

30,060

The password isn't stored in an easily recoverable manner, and if you change the password, the application may not be able to access the database properly. You may find the password in the application settings or docs, though.

If you decide to risk changing the postgres user's password, stop the application and postgres service, then edit pg_hba.conf, Add (or change if it already exists) a line (if it doesn't exist, add it before any other "host...." lines)

host   all   all   127.0.0.1/32   trust

And restart the PostgreSQL service. That should give you access from localhost, where you could change the postgres user's password, or add yourself another user with the permissions you want. Then set the pg_hba.conf file back the way it was and restart.

Share:
30,060
Abhishek
Author by

Abhishek

Updated on July 27, 2022

Comments

  • Abhishek
    Abhishek almost 2 years

    I am working on an open source application that has PostgreSQL as its default DBMS. Now when I install it on my system, its configuration is so that PostgreSQL also gets installed with it.

    My problem is with getting an access to the installed PostgreSQL database. The database that gets created during installation is named iviewdb.

    I read at many forums that the default super-user is postgres but when I try to get an access to the database using this username through command-prompt, it prompts me for password that I don't have.

    What I wanted to know from is where in the PostgreSQL installation directory the default username and password with the port number to access the database is stored. I have even tried changing the pg_hba.conf file, but that creates problem with the application and it won't start then.

    Do you have any idea to find the password for this database? I am working on Windows environment.