Quantcast
Channel: How do you create a read-only user in PostgreSQL? - Stack Overflow
Viewing all articles
Browse latest Browse all 14

How do you create a read-only user in PostgreSQL?

$
0
0

I'd like to create a user in PostgreSQL that can only do SELECTs from a particular database. In MySQL the command would be:

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

What is the equivalent command or series of commands in 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.


Viewing all articles
Browse latest Browse all 14

Latest Images

Trending Articles





Latest Images