I have set pgpassword in .bashrc
:
vim .bashrc
export PGPASSWORD=pass_for_postgresql
It is no need to type password for command psql -U postgres
.
When i dump a table from db1 into db2 with :
pg_dump -U postgres -t table db1 | psql -U postgres -W db2
The command will ask me to type password.
I have googled an article to dicuss this
http://www.londatiga.net/it/database-it/how-to-use-postgresql-pgdump-in-crontab-without-password/
Create a ~/.pgpass file in user’s home directory with the following format:
hostname:port:database:username:password
Ex: localhost:5432:mydatabase:lorenz:lorensxyz
There are many databases here,how can write the .pgpass file then?
localhost:5432:db1,db2,db3,db4:postgres:pass
How can make PG_DUMP work for all databases without asking password?