PostgreSQL中如何創建只讀用戶? - How do you create a read-only user in PostgreSQL?

問題:

I'd like to create a user in PostgreSQL that can only do SELECTs from a particular database.我想在 PostgreSQL 中創建一個只能從特定數據庫執行 SELECT 的用戶。 In MySQL the command would be:在 MySQL 中,命令將是:

GRANT SELECT ON mydb.* TO 'xxx'@'%' IDENTIFIED BY 'yyy';

What is the equivalent command or series of commands in PostgreSQL? PostgreSQL 中的等效命令或一系列命令是什麼?

I tried...我試過了...

postgres=# CREATE ROLE xxx LOGIN PASSWORD 'yyy';
postgres=# GRANT SELECT ON DATABASE mydb TO xxx;

But it appears that the only things you can grant on a database are CREATE, CONNECT, TEMPORARY, and TEMP.但似乎您可以對數據庫授予的唯一權限是 CREATE、CONNECT、TEMPORARY 和 TEMP。


解決方案:

參考一: https://stackoom.com/question/3BlS
參考二: How do you create a read-only user in PostgreSQL?
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章