Skip to content

Instantly share code, notes, and snippets.

@mbreese
Created January 30, 2018 15:56
Show Gist options
  • Save mbreese/8ddb5c1071b0d54b965cc5a08a66cdcd to your computer and use it in GitHub Desktop.
Save mbreese/8ddb5c1071b0d54b965cc5a08a66cdcd to your computer and use it in GitHub Desktop.
Add a new user to Postgres
CREATE ROLE db_user LOGIN ENCRYPTED PASSWORD 'secret-password' NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION;
CREATE DATABASE db_name WITH OWNER db_user;
GRANT ALL PRIVILEGES ON DATABASE db_name TO db_user;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment