I need to use the pg_dump command to dump my development db to a file and then upload this to my heroku hosted rails app.
I am unable to use the rails command
I have been asked by Heroku support to use the pg_dump tool to send transfer databases between cleint and server.
I just ran this command:
pg_dump -U XXXXX -w app0521_development
It output the entire contents of my database to the console
But this command for some reason fails:
pg_dump -U postgres -w app0521_development > test.dump
with this error message -bash: test.dump: Permission denied
I think you will either need to make a special folder and give the postgres user/group access read+write to it, or you should be able to send it to /tmp/test.dump;
pg_dump -U postgres -w app0521_development > /tmp/test.dump
Most of the time (at least on Ubuntu), the /tmp folder has "read+write+execute" for everyone. Just a warning... if it's got sensative data, it's out there for everyone that can get on that box. So, clean it up! And also of note, the /tmp folder has the "t" flag set. The "t" indicates that only the user (and root) that created a file in this directory can delete that file.
If you want to create your own folder, just google "chgrp" - and then of course you need to give "read-write" to the group.