psql: permission denied for database “dbname” (“User does not have CONNECT privilege.”) / “unrecognized role option 'connect'”

橙三吉。 提交于 2019-12-12 07:26:18

问题


when I try to login to my database with psql, doing this:

psql dbname --username=qgis --password
>>(prompts for password, entered password)
psql: FATAL:  permission denied for database "gisdatabase"
DETAIL:  User does not have CONNECT privilege.

I've searched around on Google for information on this simple issue but haven't found anyone directly talking about this.

I've tried doing this:

psql dbname
>>ALTER ROLE qgis WITH CONNECT;

But got this error:

ERROR:  unrecognized role option "connect"

So once again, here I am, asking yet another question on stackoverflow. Thanks for your time folks


回答1:


You need to grant a privilege. Try this:

psql dbname
>> GRANT CONNECT ON DATABASE dbname TO qgis;

I assume you will also need further privileges. PostgreSQL has one of the best documentation pages of all the DBMSs: http://www.postgresql.org/docs/9.0/static/sql-grant.html (You can choose the postgres version you're using at the top of the page).



来源:https://stackoverflow.com/questions/19302398/psql-permission-denied-for-database-dbname-user-does-not-have-connect-privi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!