1

I run

psql --host=127.0.0.1 --port=5432 --username=postgres

success, but I must pass password (My password is 123456a@) directly to command. (I will run batch command.) How to do this?

James Graham
  • 39,063
  • 41
  • 167
  • 242

1 Answers1

2

create a .pgpass file in your home directory with this format

hostname:port:database:username:password

you can substitute any of the fields with a wild card for example if you use the same login for everything

*:*:*:username:password
Chad Scira
  • 9,423
  • 3
  • 53
  • 48