Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Dexyne/8448039 to your computer and use it in GitHub Desktop.
Save Dexyne/8448039 to your computer and use it in GitHub Desktop.
"Post-it" for create user + database and assign database to user in PostgreSQL.
- terminal:
createuser -P user_name
- Answer questions:
enter password for new role:
Enter it again:
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) n
Shall the new role be allowed to create more new roles? (y/n) n
- terminal:
createdb db_name
- terminal:
psql db_name
grant all privileges on database db_name to user_name;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment