1

I'm trying to backup the database I made in postgresql but it doesn't seem to work

root@localhost:/home/tests# sudo -s -u postgres
postgres@localhost:/home/tests$ psql
psql (8.4.17)
Type "help" for help.
postgres=# pg_dump test_site > payroll.dump.out  
postgres-# ls
postgres@localhost:/home/tests$ exit
root@localhost:/home/tests# ls # Where is the backup?
cars  manage.py  media  staticfiles  test.db  tests  tests.db  test.wsgi

Can someone help me , please :)

1 Answer 1

4

pg_dump is not an SQL command. It's a separate command, like psql. So you can't run it from within a psql session, you must run it from a regular shell.

The reason you're not getting an outright error is that you didn't write a semicolon on the end of the line. That's why the prompt changed, too:

postgres=# pg_dump test_site > payroll.dump.out  
postgres-# ls
        ^ <-- See how it goes from = to - ?

That indicates that it's a continuation line, so psql is buffering up a statement and hasn't sent it yet.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.