Skip to content

Instantly share code, notes, and snippets.

@okram999
Created July 30, 2019 14:14
Show Gist options
  • Save okram999/32ebff98d1fcb97b53edf73a99c0d36a to your computer and use it in GitHub Desktop.
Save okram999/32ebff98d1fcb97b53edf73a99c0d36a to your computer and use it in GitHub Desktop.
Adding a user or granting access
Create new user: CREATE USER <userid> WITH PASSWORD <password>;
User should change password after login: ALTER ROLE your_userid WITH PASSWORD 'new_password';
Create a role: CREATE ROLE < Role Name>
Grant PRIVILEGES to Role: GRANT SELECT ON all tables in schema public to <role_name>
Assign role to user: GRANT <Role Name> TO <User Id>;
Revoke permissions: REVOKE <userId> FROM <role name>;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment