Skip to content

Instantly share code, notes, and snippets.

@samueltc
Created October 7, 2018 18:48
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 samueltc/4d63d10eacc78052e97c0f29cc141d20 to your computer and use it in GitHub Desktop.
Save samueltc/4d63d10eacc78052e97c0f29cc141d20 to your computer and use it in GitHub Desktop.
psql postgres
CREATE ROLE new_user WITH PASSWORD 'big secure pass';
psql new_db
GRANT CONNECT ON DATABASE new_db TO new_user;
GRANT USAGE ON SCHEMA public TO new_user;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO new_user;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO new_user;
GRANT ALL PRIVILEGES ON ALL FUNCTIONS IN SCHEMA public TO new_user;
GRANT CONNECT ON DATABASE new_db TO new_user;
ALTER ROLE new_user WITH LOGIN;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment