[ADMIN] pg_dump password

Top Page

Reply to this message
Author: Erick Ruiz
Date:  
To: pgsql-admin
Subject: [ADMIN] pg_dump password
I didn't understand how to insert a password into pg_dump command line.

So I write this steps for insert password on pg_dump.

1) Connect to postgres user
[root@]# su - postgres

2) Create a .pgpass file
Bash$ vi .pgpass
( it contains a single line like
http://www.postgresql.org/docs/8.2/interactive/libpq-pgpass.html mention it)
*:5432:database:username:password

Bash$ chmod 600 .pgpass
(also I change this file to being used by postgres, with chown
postgres.postgres .pgpass, I don't know if it works with root)

3) The postgres dump command line
Bash$ /usr/bin/pg_dump database > /var/lib/pgsql/backups/bkup.sql

For finish the test, I will put the line into a crontab or script.

But is the same for pg_dumpall? Or I need to create another line into
.pgpass file? I'll try.

Thanks

Lic. Erick Ruiz Rojas






















I didn’t understand how to insert a
password into pg_dump command line.

 

So I write this steps for insert password
on pg_dump.

 

1)     
Connect to postgres user

[root@]# su – postgres

 

2)     
Create a .pgpass file (into
postgres session)

Bash$ vi .pgpass

 ( it contains a single line
like http://www.postgresql.org/docs/8.2/interactive/libpq-pgpass.html
mention it)

                *:5432:database:username:password

 

Bash$ chmod 600
.pgpass

(also I change
this file to being used by postgres, with chown postgres.postgres .pgpass, I
don’t know if it works with root)

 

3)     
The postgres dump command line

Bash$ /usr/bin/pg_dump database >
/var/lib/pgsql/backups/bkup.sql

 

For finish the test, I will put the line
into a crontab or script.

 

But is the same for pg_dumpall? Or I need
to create another line into .pgpass file? I’ll try.

 

Thanks

 

Lic. Erick Ruiz Rojas

 

 







---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend