由于权限,无法使用pg_dump转储Django数据库

时间:2018-05-28 22:00:37

标签: django postgresql ubuntu

我想将PostgreSQL数据库转储到SQL文件中。这是pg_dump DB_NAME > dump.sql命令结果:

pg_dump: [archiver (db)] query failed: ERROR:  permission denied for relation django_migrations
pg_dump: [archiver (db)] query was: LOCK TABLE public.django_migrations IN ACCESS SHARE MODE

当我想列出关系时:

postgres=# \d
No relations found.

架构列表:

                          List of schemas
  Name  |  Owner   |  Access privileges   |      Description       
--------+----------+----------------------+------------------------
 public | postgres | postgres=UC/postgres+| standard public schema
        |          | =UC/postgres        +| 
        |          | root=U/postgres     +| 
        |          | secretusr=U/postgres | 
(1 row)

数据库列表:

                                  List of databases
   Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges    
-----------+----------+----------+-------------+-------------+------------------------
 db_secret | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =Tc/postgres          +
           |          |          |             |             | postgres=CTc/postgres +
           |          |          |             |             | secretusr=CTc/postgres+
           |          |          |             |             | root=CTc/postgres
 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
(4 rows)

问题出在哪里?

0 个答案:

没有答案