By using this site, you agree to the Privacy Policy.
Accept
EnterinITEnterinITEnterinIT
  • HOME
  • IT PRO
  • TECH
  • MICROSOFT
    • Azure
    • ConfigMgr/SCCM
    • DPM
    • Orchestrator
    • Hyper-V
    • Microsoft Edge Insider
    • MSI
    • Office 365
    • Office Insider
    • Power BI
    • Skype
    • SQL Server
    • Teams
  • WINDOWS
    • Windows Admin Center
    • Windows Client
    • Windows Server
  • SCCM Query Collection List
Reading: How to Create a Superuser ROLE in PostgreSQL
Font ResizerAa
EnterinITEnterinIT
Font ResizerAa
  • HOME
  • IT PRO
  • TECH
  • MICROSOFT
  • WINDOWS
  • SCCM Query Collection List
Search
  • HOME
  • IT PRO
  • TECH
  • MICROSOFT
    • Azure
    • ConfigMgr/SCCM
    • DPM
    • Orchestrator
    • Hyper-V
    • Microsoft Edge Insider
    • MSI
    • Office 365
    • Office Insider
    • Power BI
    • Skype
    • SQL Server
    • Teams
  • WINDOWS
    • Windows Admin Center
    • Windows Client
    • Windows Server
  • SCCM Query Collection List
PostgreSQL

How to Create a Superuser ROLE in PostgreSQL

Published February 18, 2024
2 Min Read
SHARE

How to Create a Superuser ROLE in PostgreSQL.

PostgreSQL onwards uses the concept of ROLE instead of USER. A role can be a user or a group depending on your configuration. So we will create a ROLE with superuser privileges.

Log into PostgreSQL and run the following command to create a new role with superuser privileges. Replace test_role as per your requirement.

CREATE ROLE test_role LOGIN SUPERUSER;

A database role has all permissions, except the permission to login. So you need to grant it to the new role.

If you also want to assign a login password, modify the above command to the following. Replace test_password with your choice of password.

CREATE ROLE rolename LOGIN SUPERUSER PASSWORD 'test_password';

You can also create a non-super user ROLE and then make it a superuser as shown below. Replace test_role with your choice of role.

CREATE ROLE test_role LOGIN;
ALTER ROLE test_role WITH SUPERUSER;

Here is the command to change the superuser into a regular role.

ALTER ROLE test_role WITH NOSUPERUSER;

Here is the command to create a user with superuser privileges as per the PostgreSQL version lower than 8.1. Replace test_user as your requirement.

CREATE USER test_user SUPERUSER;

If you want your superuser to have a login password, modify the above command as shown below.

CREATE USER username SUPERUSER WITH PASSWORD 'test_password';
TAGGED:dbPostgresql
Previous Article Office Insider 2108 for Windows
Next Article Disable weak SSH encryption algorithms
Leave a Comment Leave a Comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Translation

English中文(简体)DanskNederlandsFrançaisDeutschItaliano한국어PolskiPortuguêsRomânăEspañolУкраїнська
by Transposh - translation plugin for wordpress

Popular Posts

System Requirements for Windows Server 2016
Windows Server
Configuration Manager Query Collection List
Configuration Manager Query Collection List
ConfigMgr
Structured/Managed Navigation enabled on Modern Pages in Classic Team Sites
Tech
SCCM Failed to get DP locations as the expected version from MP
ConfigMgr

Recent Posts

Installing and Configuring Fail2ban for SSH Protection on Ubuntu 24.04
Linux
Enabling and Configuring FirewallD on AlmaLinux
Linux
User Creation and SSH Key Setup in AlmaLinux
Linux
How to reset password on AlmaLinux
Linux

© 2023 EnterinIT

Go to mobile version
adbanner
Welcome Back!

Sign in to your account

Username or Email Address
Password

Lost your password?