HiveBrain v1.2.0
Get Started
← Back to all entries
snippetsqlCritical

Granting a user account permission to create databases in PostgreSQL

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
postgresqldatabasescreateuserpermissiongrantingaccount

Problem

How do I give a user account in PostgreSQL the ability to create and drop databases? Is there a way to do this with GRANT?

Solution

It's done with ALTER USER username CREATEDB;

See ALTER USER in the doc.

To drop a database, either you're superuser (which can be granted with ALTER USER too) or you must own the database.

Context

StackExchange Database Administrators Q#33285, answer score: 296

Revisions (0)

No revisions yet.