Postgresql: Scripting psql execution with password

后端 未结 16 2434
谎友^
谎友^ 2020-11-28 18:54

How can I call psql so that it doesn\'t prompt for a password?

This is what I have:

psql -Umyuser < myscript.sql         


        
16条回答
  •  抹茶落季
    2020-11-28 18:59

    You can add this command line at the begining of your script:

    set PGPASSWORD=[your password]
    

提交回复
热议问题