[英]Setting PostgreSQL privileges for a remote connection
I want to set a user which I can use remote, that for a database can: 我想设置一个可以远程使用的用户,该用户可以对数据库进行以下操作:
I executed: 我执行了:
GRANT ALL PRIVILEGES ON DATABASE "example" to user_name;
REVOKE CREATE ON DATABASE "example" FROM user_name;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO user_name;
The following fails: 以下失败:
REVOKE CREATE ALL TABLES IN SCHEMA public FROM user_name;
invalid privilege type CREATE for relation
Can you, please, add all necessary steps. 能否请您添加所有必要的步骤。
Also,: 也,:
You probably want to keep the user from crating tables in schema public
. 您可能希望阻止用户创建模式public
表。
For that, you must revoke the CREATE
privilege on that schema which is by default granted to everybody: 为此,您必须撤销该模式的CREATE
特权,默认情况下,该特权授予每个人:
REVOKE CREATE ON SCHEMA public FROM PUBLIC;
If you want to user to have permissions on tables that will be created in the future, consider using ALTER DEFAULT PRIVILEGES
. 如果希望用户对将来将要创建的表具有权限,请考虑使用ALTER DEFAULT PRIVILEGES
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.