psql.exe - password authentication failed in windows

后端 未结 3 1483
小蘑菇
小蘑菇 2021-02-05 07:57

I\'m a noob in PostgreSQL. I installed ver 9.2 on windows7. During installation it asked for password and i entered it. Now whenever i run d:\\tools\\PostgreSQL9.2\\bin\\psql.ex

3条回答
  •  Happy的楠姐
    2021-02-05 08:38

    Try setting the user name when connecting.

    psql.exe -U username -d dbname -f somefile.sql
    

    You've probably set up the default "postgres" user during installation. Not sure if you've created any others.

    To add other users and databases just connect to as postgres to the postgres database and do something like:

    CREATE USER myuser WITH ENCRYPTED PASSWORD 'secret';
    CREATE DATABASE mydb OWNER myuser;
    

    If your machine is secure you might also like to set up a password file

提交回复
热议问题