2

I want to import 'prod.sql' file to database 'd_p_d' for 'postgres' user

postgres=# \l
 d_p_d                 | postgres | UTF8     | en_IN   | en_IN | 
 postgres              | postgres | UTF8     | en_IN   | en_IN | 
 template0             | postgres | UTF8     | en_IN   | en_IN | =c/postgres          +
                       |          |          |         |       | postgres=CTc/postgres
 template1             | postgres | UTF8     | en_IN   | en_IN | =c/postgres          +
                       |          |          |         |       | postgres=CTc/postgres


postgres=# \du
 postgres  | Superuser, Create role, Create DB, Replication | {}

The error:

postgres=# \i /home/pallavsharma/prod.sql
/home/pallavsharma/prod.sql: Permission denied

also

postgres=# \i /var/dump/prod.sql
/var/dump/prod.sql: Permission denied

1 Answer 1

3

The solution is simple CHANGE OWNER of the file prod.sql by following command :

pallavsharma@smartbuzz-G41M-Combo:/var/dump$ sudo chown postgres prod.sql
[sudo] password for pallavsharma: 

Then simply import the db :

postgres=# \i /var/dump/prod.sql

Thats it, it worked.

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.