Creating users in PostgreSQL

This one has thrown me one too many times, and short of a better place to note this sequence of commands down, I’m posting it here.

postgres=> CREATE USER new_user WITH PASSWORD 'SuperSecurePassword';
CREATE ROLE
postgres=> GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO new_user;
GRANT
postgres=> GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO new_user;
GRANT
postgres=> GRANT USAGE ON SCHEMA public TO new_user;
GRANT
postgres=> \q

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>