Created
October 3, 2017 13:58
-
-
Save scragg0x/b4f7219792d0f9894fc0ddb54c934ca8 to your computer and use it in GitHub Desktop.
Postgresql: setting up user / database without super user
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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