Just installed Postgresql on Windows 7. I was not asked to set a password during installation. When i run psql, I'm asked for a password. Googled some and the only possible default password was "postgre". But that didn't work. Also tried a blank password and my Windows password. Neither of them worked. Read some advanced stuff how to reset a password, but this can't be right? What am I missing here? What password am I suppose to enter?
There is no 'default' PostgreSQL username/password. The credentials supplied in the install process are also used to make these accounts. If you know that username and password you might be able to use the same password to log into PostgreSQL.
Login and Connect as Default User For most systems, the default Postgres user is postgres and a password is not required for authentication. Thus, to add a password, we must first login and connect as the postgres user.
On Microsoft Windows the file is named %APPDATA%\postgresql\pgpass. conf (where %APPDATA% refers to the Application Data subdirectory in the user's profile). Alternatively, the password file to use can be specified using the connection parameter passfile or the environment variable PGPASSFILE .
The default username for postgres is postgres. (If you are using Advanced Server it is enterprisedb.) On a Mac or Windows, you are able to connect to the default instance by simply hitting enter at the shell or command prompt when trying to run psql and keying in the password.
Try this:
Open PgAdmin -> Files -> Open pgpass.conf
You would get the path of pgpass.conf
at the bottom of the window. Go to that location and open this file, you can find your password there.
Reference
If the above does not work, you may consider trying this:
1. edit pg_hba.conf to allow trust authorization temporarily 2. Reload the config file (pg_ctl reload) 3. Connect and issue ALTER ROLE / PASSWORD to set the new password 4. edit pg_hba.conf again and restore the previous settings 5. Reload the config file again
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With