Question

So, I have a Pyramid app with a postgres database on my local machine. I did a pg_dump to get a dump of the data in my database, called pg_dump_2014-04-22. I then git pushed this file, and did a git pull in the VPS to get the file.

Now, I have already installed postgres on my VPS. When I sudo -u postgres psql on my VPS, I can connect to it but there are no relations (naturally).

Both my username and database name are postgres.

So, I tried psql postgres < pg_dump_2014-04-22, but this gives the error psql: FATAL: role "root" does not exist.

I also tried pg_restore -h localhost -U postgres -d postgres pg_dump_2014-04-22, and that prompts me for my password, but then throws the error pg_restore: [archiver(db)] connection to database "postgres" falied: FATAL: password authentication failed for user postgres"

What am I missing here?

Was it helpful?

Solution

You first have to create a user and the database where you want to import your dump

su postgres

createuser root

createdb yourdb

Then import the dump with

psql -d yourdb -f pg_dump_2014-04-22

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top