Do not routinely work with the cluster as the bootstrap user. Create other users with the necessary privileges and leave the bootstrap user as a fallback in case of emergency.
Bootstrap user privileges
The bootstrap user is not a superuser but has administrative privileges. It has themsp_admin and msp_superuser roles defined in Managed Service for PostgreSQL.
-
msp_admingives the following privileges:pg_monitorandpg_signal_backendpredefined roles.- Subscription for logical replication (
CREATE | DROP | ALTER SUBSCRIPTION). - Ability to enable extensions (
CREATE EXTENSION). - Extension-specific functions:
pg_stat_reset()andpg_stat_statements_reset()from the pg_stat_statements extension.
-
msp_superuserenables you to bypass ownership verification when you grant and revoke privileges.
msp_admin role but not the msp_superuser role.
How to manage users
Create a new user
- Connect to the cluster via psql as a user with administrative privileges (for example, the bootstrap user).
-
Create a new user with privileges to connect to a
<test_db>database. Execute the following SQL statements:<db_user>can connect to the<test_db>database and work with the data. The following usernames are reserved, do not specify them:admin,repl,monitor,postgres,publicandnone. -
(Optionally) If you need to grant them additional privileges for the database:
-
Connect to the cluster as the user that owns the
<test_db>database. Usually, the database owner is the user who created it. Alternatively, connect as the boostrap user to bypass the database ownership check. -
Execute the following SQL statement:
-
Connect to the cluster as the user that owns the
Create a new user with administrative privileges
To create a user with administrative privileges, connect as the bootstrap user and execute the following SQL statements:<new_admin> can create databases, create users and grant them privileges. The msp_admin role lets them bypass checks when interacting with data.
You cannot grant the msp_superuser role. You can grant any predefined roles except for the following:
role_pg_read_server_filesrole_pg_write_server_filesrole_pg_execute_server_programrole_pg_read_all_datarole_pg_write_all_data
admin, repl, monitor, postgres, public and none.
Manage the bootstrap user
- Web console
- CLI
- Terraform
To change the password of the bootstrap user:
- In the sidebar, go to
Storage → PostgreSQL.
- Click your cluster and go to Settings.
- In the Database section, enter the new password.
- Click Update cluster.
Delete a user
To delete a user, connect to the cluster as a user with administrative privileges and execute the following SQL statement:Postgres, PostgreSQL and the Slonik Logo are trademarks or registered trademarks of the PostgreSQL Community Association of Canada, and used with their permission.