Zum Hauptinhalt springen
•
IT NachrichtenToday’s Wordle Hints, Answer and Help for Oct. 5, #1934(04.10.2026 um 22:00 Uhr)
••••
Sicherheitslücken (CVE)Citrix NetScaler ADC / Gateway Schwachstelle CVE-2026-88779 patchen(04.10.2026 um 18:01 Uhr)
•••
IT NachrichtenEA Sports FC 27 angebolzt(04.10.2026 um 21:30 Uhr)
•
Apple iOS & macOSSunday Reboot: Waiting a decade for Apple Pay and Apple Music(04.10.2026 um 22:07 Uhr)
••
IT NachrichtenToday’s Wordle Hints, Answer and Help for Oct. 5, #1934(04.10.2026 um 22:00 Uhr)
••••
Sicherheitslücken (CVE)Citrix NetScaler ADC / Gateway Schwachstelle CVE-2026-88779 patchen(04.10.2026 um 18:01 Uhr)
•••
IT NachrichtenEA Sports FC 27 angebolzt(04.10.2026 um 21:30 Uhr)
•
Apple iOS & macOSSunday Reboot: Waiting a decade for Apple Pay and Apple Music(04.10.2026 um 22:07 Uhr)
•
Intelligence View
⚡ tsecurity.de Intelligence

PostgreSQL: Create database with custom owner

When sharing a PostgreSQL server with multiple projects, you might want to create a database and user per project. First, we create the database. CREATE…

Beitrag
0
Seite
0
↗ Quelle (dev.to)
Social ReaktionenReagiere als Erste:r — dein Feedback zählt!

When sharing a PostgreSQL server with multiple projects, you might want to create a database and user per project.



First, we create the database.




CREATE DATABASE "project";






Next, we create the user that will own the database we've just created.




CREATE USER "username" WITH PASSWORD 'super-secret-password';






Now, we should change the database owner to the custom user.




ALTER DATABASE "project" OWNER TO "username";






And we're going to explicitly set the permission for this user.




GRANT CONNECT, TEMP, CREATE ON DATABASE "project" TO "username";






Postgres by default allows public access to our database. To revoke it we should run the following query.




REVOKE CONNECT, CREATE, TEMP ON DATABASE "project" FROM PUBLIC;






If we list the databases using the \l command, the "Access privileges" column should display the following.




postgres=# \l
List of databases
Name | Owner | ... | Access privileges
------------+------------+-----+-----------------------------------
project | username | ... | username=CTc/project






Now you have a new database on your Postgres server ready to use for your next project!

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten PostgreSQL: Create database with custom owner

Thematisch verwandte Begriffe: PostgreSQL, Create, database, with · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

💬 Kommentare werden geladen…
Zum Aktualisieren ziehen
Nächster Beitrag