PostgreSQL Dump

Hi all,

I’m using following command to take dump from my sql database.

pg_dump -h localhost -U postgres dbname > dump.sql

Whenever i trying to run this command in command prompt, it always
asking password.

Here my query is,

if i write this command in a separate ruby file how can i give password
in that command.

in my sql, we can use
mysqldump -h #{host} -u #{user} -p#{pwd} dbname > dump.sql
if use like that it wont ask password anymore. but how is it possible in
postgres.

Thanks in Advance
Saravanan K

Saravanan K. wrote:

Hi all,

I’m using following command to take dump from my sql database.

pg_dump -h localhost -U postgres dbname > dump.sql

Whenever i trying to run this command in command prompt, it always
asking password.

Here my query is,

if i write this command in a separate ruby file how can i give password
in that command.

in my sql, we can use
mysqldump -h #{host} -u #{user} -p#{pwd} dbname > dump.sql
if use like that it wont ask password anymore. but how is it possible in
postgres.

Thanks in Advance
Saravanan K

Hi folks,

I fixed that issue thanks
refered link

Thanks