Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have a database currently with the correct permissions. I'm attempting to create a duplicate but i can't get the permissions to be the same.

i created a dump with

pg_dump database1 > dbdump

Then i create a database with

createdb database2

Then i used the dump to restore the newly created database.

psql database2 < dbdump

To see the permissions i did a \l and i have the following:

                                  List of databases
   Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   
-----------+----------+----------+-------------+-------------+-----------------------
 database1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =T/postgres          +
           |          |          |             |             | postgres=CTc/postgres+
           |          |          |             |             | root=CTc/postgres
 database2 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
 template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
(5 rows)

As you can see, the Access privileges aren't the same on database2.

I tried the following command,

GRANT ALL ON ALL TABLES IN SCHEMA public TO root;

but that didn't seem to change anything and i can't log into the database over SSH using the username/password i can with database1.

share|improve this question

1 Answer 1

Check your pg_hba.conf file, that specifies which user on which host can connect to which database using what authentication mechanism.

You might want to base it on the content of the file in the working initial database.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.