pg_restore with -C option does not create the database

Exactly like @Eelke said – you’ve got in file wrote ‘create database’ so this database does not exist when you’re running script… That’s what for there is always ‘postgres’ database. Try this:

pg_restore -C -d postgres -v -h xxhostxx -p 5432 -U xxuserxx test_pg_dump.dmp**

And this should:

  1. connect to postgres database
  2. Create test database
  3. Disconnect from postgres and connect to test
  4. Upload data into database

Of course check who is owner of postgres database – in most cases you have to run this as user ‘postgres’.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)