Skip to content

Instantly share code, notes, and snippets.

@hazelement
Created September 5, 2018 20:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hazelement/f1b817ef787503128a819f912ca7c723 to your computer and use it in GitHub Desktop.
Save hazelement/f1b817ef787503128a819f912ca7c723 to your computer and use it in GitHub Desktop.
Postgres
/* create user with password */
CREATE USER xxx WITH ENCRYPTED PASSWORD 'xxxxxxx';
/* set permissions */
GRANT CONNECT ON DATABASE mydb TO xxx;
GRANT USAGE ON SCHEMA public TO xxx;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO xxx;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO xxx;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment