Apache Cloudberry manages database access using roles. Initially, there is one superuser role, the role associated with the OS user who initialized the database instance, usually gpadmin
. This user owns all of the Apache Cloudberry files and OS processes, so it is important to reserve the gpadmin
role for system tasks only.
A role can be a user or a group. A user role can log into a database; that is, it has the LOGIN
attribute. A user or group role can become a member of a group.
Permissions can be granted to users or groups. Initially, only the gpadmin
role is able to create roles. You can add roles using the createuser
utility command, CREATE ROLE
SQL command, or the CREATE USER
SQL command. The CREATE USER
command is the same as the CREATE ROLE
command except that it automatically assigns the role the LOGIN
attribute.
Quick-start operations
You can follow the examples below to create users and roles.
Before moving on to the operations, make sure that you have installed Apache Cloudberry by following Install a Single-Node Apache Cloudberry.
Create a user using the CREATE USER command
-
Log into Apache Cloudberry in Docker. Connect to the database as the
gpadmin
user.[gpadmin@mdw ~]$ psql
psql (14.4, server 14.4)
Type "help" for help.gpadmin=#
-
Create a user named
lily
using theCREATE USER
command, with a passwordchangeme
. After the creation, you need to enter the password to log in as the userlily
.gpadmin=# CREATE USER lily WITH PASSWORD 'changeme';