Skip to content

Instantly share code, notes, and snippets.

@scragg0x
Created October 3, 2017 13:58
Show Gist options
  • Save scragg0x/b4f7219792d0f9894fc0ddb54c934ca8 to your computer and use it in GitHub Desktop.
Save scragg0x/b4f7219792d0f9894fc0ddb54c934ca8 to your computer and use it in GitHub Desktop.
Postgresql: setting up user / database without super user
CREATE USER username WITH CREATEDB;
GRANT username TO postgres;
SET ROLE username;
CREATE DATABASE databasename OWNER username;
SET ROLE postgres;
ALTER USER username WITH NOCREATEDB;
\password username
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment