Josh Davies
Josh Davies

Reputation: 373

Backing up all data from a postgreSQL DB (Django Site)

I'm trying to backup all the content from my postgresql database. I have 2 sites my live one and the dev one. All the code is in sync i just want to copy all the data across to the dev site to do some tests on then add data and then copy it back across.

I've tried going through the documentation on the postgres site and i'm having now luck.

commands i ran to do the dump / restore:

pg_dump db_name > joshtestdump 
psql dbname < joshtestdump –

When i run the first command to dump the database, I get the following error message:

pg_dump: [archiver (db)] connection to database "db_name" failed: FATAL:  Ident authentication failed for user "josh"

Just to add, the username and password for the databse are blank. Does this have an affect on anything?

I'm new to postgreSQL and every tutorial on the web pretty much does the same thing.

Please let me know if you need anymore details!

Here are my DB details:

DATABASE_ENGINE = 'postgresql_psycopg2'           # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = 'db_name'             # Or path to database file if using sqlite3.
DATABASE_USER = ''             # Not used with sqlite3.
DATABASE_PASSWORD = ''         # Not used with sqlite3.
DATABASE_HOST = ''             # Set to empty string for localhost. Not used with sqlite3.
DATABASE_PORT = ''             # Set to empty string for default. Not used with sqlite3.

Thanks,

Josh

UPDATED

Upvotes: 1

Views: 5128

Answers (1)

Richard Huxton
Richard Huxton

Reputation: 22893

  1. Why are you using gzip rather than --format to get a compressed dump?
  2. Why are you doing this as root?
  3. Why are you not using pg_restore to restore your database?
  4. Why are you favouring random web tutorials over the actual manuals

    pg_dump -U some_user -Fc database_name > mydb.dump

    pg_restore -U some_user -d database_name mydb.dump

Upvotes: 5

Related Questions