How to log in as "postgres" user with PostgreSQL 8.4.7 on Windows 7

postgresql, windows

Solution

The `postgres` account is a service account. It doesn't have the login right, and cannot be logged into. You can use `runas.exe` to run commands as the PostgreSQL user account, or shift-right-click on a program and use "Run as...".

In PostgreSQL 9.2 and above the installer puts PostgreSQL in the `NETWORKSERVICE` by default, so no `postgres` user account needs to be created.

In general, there is no need to run programs as the `postgres` user on Windows. Just specify the user to connect to the PostgreSQL server as, eg:

psql -U postgres -h localhost dbname

Problem

I installed PostgreSQL on my windows 7 desktop. Usually PostgreSQL will create new account on my desktop, but when i want to switch user, there's no user named `postgres`. Then I checked the user folder in directory "C" and there's already a folder user named `postgres`. But why can't I log in into my desktop using `postgres` account?

Original source