![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I need to run several .sql files using psql. To do that I have prepared following batch file: psql -h 10.x.x.x -U postgres -f create_database.sql psql -h 10.x.x.x -f create_schema.sql dbname postgres etc. The problem is, that psql is asking me about dbuser's password for each row. I would rather to specify password in batch file, but I cannot find such psql option in the documentation. Any idea how to solve this problem? |
#3
| |||
| |||
|
|
I need to run several .sql files using psql. To do that I have prepared following batch file: psql -h 10.x.x.x -U postgres -f create_database.sql psql -h 10.x.x.x -f create_schema.sql dbname postgres etc. The problem is, that psql is asking me about dbuser's password for each row. I would rather to specify password in batch file, but I cannot find such psql option in the documentation. Any idea how to solve this problem? |
#4
| |||
| |||
|
|
In article <ehsoen$lhg$1 (AT) news (DOT) onet.pl>, Krzysztof Adamski <akamski (AT) op (DOT) pl> wrote: I need to run several .sql files using psql. To do that I have prepared following batch file: psql -h 10.x.x.x -U postgres -f create_database.sql psql -h 10.x.x.x -f create_schema.sql dbname postgres etc. The problem is, that psql is asking me about dbuser's password for each row. I would rather to specify password in batch file, but I cannot find such psql option in the documentation. Any idea how to solve this problem? You should also be able to eliminate the need to actually use a password if you are on a UNIX-like system. Since psql will use the username of the user who ran the program, you don't have to specify and user if you run the program as the postgres user. Also, you generally don't have to enter a password for the database if the database is configured to authenticate based on the userid of the user who ran the program. |
#5
| |||
| |||
|
|
Aaron Hsu <aaron.hsu (AT) sacrificumdeo (DOT) net> wrote: In article <ehsoen$lhg$1 (AT) news (DOT) onet.pl>, Krzysztof Adamski <akamski (AT) op (DOT) pl> wrote: I need to run several .sql files using psql. To do that I have prepared following batch file: psql -h 10.x.x.x -U postgres -f create_database.sql psql -h 10.x.x.x -f create_schema.sql dbname postgres etc. The problem is, that psql is asking me about dbuser's password for each row. I would rather to specify password in batch file, but I cannot find such psql option in the documentation. Any idea how to solve this problem? You should also be able to eliminate the need to actually use a password if you are on a UNIX-like system. Since psql will use the username of the user who ran the program, you don't have to specify and user if you run the program as the postgres user. Also, you generally don't have to enter a password for the database if the database is configured to authenticate based on the userid of the user who ran the program. If, and only if, the client is on the same machine as the server. Else authentication 'trust' would be suicide. |
#6
| |||
| |||
|
|
Hi All, I need to run several .sql files using psql. To do that I have prepared following batch file: psql -h 10.x.x.x -U postgres -f create_database.sql psql -h 10.x.x.x -f create_schema.sql dbname postgres etc. The problem is, that psql is asking me about dbuser's password for each row. I would rather to specify password in batch file, but I cannot find such psql option in the documentation. Any idea how to solve this problem? Thanks in advance, Krzysiek From - Sun you can test: |
![]() |
| Thread Tools | |
| Display Modes | |
| |