0

I have building and testing a psql database on my local machine, and the time is come to move it to a server. I have my dump file, but I'm not sure how to actually get it on the server to restore it there. Obviously something like the following doesn't work:

psql -U user -d datbase < C:/dbbackups/dbbackup.dump

But what is the proper way to get my dump on the server from my local to properly restore it?

1 Answer 1

1

You can use pg_dump.

pg_dump -C -h localhost -U localuser dbname | psql -h remotehost -U remoteuser dbname

If you want to use your dump you could of course also transfer your dump file over to the new server securly using e.g. SFTP and then restore it there as you would on your local machine.

Sign up to request clarification or add additional context in comments.

Comments

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.