我目前有一个具有正确权限的数据库。我正在尝试创建一个副本,但我无法获得相同的权限。
我创建了一个转储
pg_dump database1 > dbdump
然后我创建一个数据库
createdb database2
然后我使用转储来恢复新创建的数据库。
psql database2 < dbdump
要查看我所做的权限\l
,我有以下内容:
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)
如您所见,database2 上的访问权限不同。
我尝试了以下命令,
GRANT ALL ON ALL TABLES IN SCHEMA public TO root;
但这似乎并没有改变任何东西,我无法使用我可以使用 database1 的用户名/密码通过 SSH 登录数据库。