PostgreSql in win32: postgres password

I have a user account mayank. I created initdb to create a new cluster.
With me PGDATA=C:\pgdata. Now I want to create a new db.

When I do createdb db_test, it asks for a password. What is the password there.

I have the following entry in pg_hba.conf

# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
# IPv6 local connections:
host    all             all             ::1/128                 trust

I installed PostgreSql using the Windows installer (double click and install :-)). He asked for a password that does not work here :( What am I missing?

+3
source share
2 answers

Using the installer with one click , two different things are created:

  • Windows account and "service account" (which the postgresql.exe process belongs to)
  • PostgreSQL ( )

() postgres. Windows net user:

net user            postgres
User name           postgres
Full name           postgres
Comment             PostgreSQL service account
...
Active              Yes
Password required   Yes
...

psql :

postgres=# \du
                       List of roles
 Role name |            Attributes             | Member of
-----------+-----------------------------------+-----------
 postgres  | Superuser, Create role, Create DB | {}

mayank ( mayank), (, PostgreSQL\version\bin PATH mayank):

cmd>initdb -U mayank -D C:\pgdata
cmd>pg_ctl -D C:\pgdata -o "-p 5440" -l C:\pgdata\log start
cmd>createdb -p 5440 test

, . C:\pgdata\pg_hba.conf :

# TYPE  DATABASE        USER            CIDR-ADDRESS            METHOD

# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
# IPv6 local connections:
host    all             all             ::1/128                 trust

, . pg_ctl register postmaster Windows ( , 5432 DB), mayank " ".

+3

IIRC, Windows "". PostgreSQL, . "postgres", " " Windows.

.,.

  • Windows "postgres".

  • , PostgreSQL, Windows.

psql -U, .

+1

All Articles