Skip to content

Instantly share code, notes, and snippets.

@ob1-sc
Created April 15, 2020 09:43
Show Gist options
  • Save ob1-sc/08236f8cca765a5ad5c3c67da0595ef0 to your computer and use it in GitHub Desktop.
Save ob1-sc/08236f8cca765a5ad5c3c67da0595ef0 to your computer and use it in GitHub Desktop.
Postgres user and db creation
REVOKE CREATE ON SCHEMA public FROM PUBLIC;
CREATE ROLE <db_owner> WITH LOGIN PASSWORD '<db_owner_password>';
CREATE DATABASE <db_name> WITH OWNER=<db_owner>;
REVOKE ALL ON DATABASE <db_name> FROM public;
GRANT ALL ON DATABASE <db_name> TO <db_owner>;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment