Updated on 2025-02-27 GMT+08:00

Creating a Database Account

Only administrators that are created during database installation can access the initial database by default. You can also create other database accounts.

1
openGauss=# CREATE USER joe WITH PASSWORD "xxxxxxxxx";

If the following information is displayed, the creation is successful:

1
CREATE ROLE

In this case, you have created a user account named joe, and the user password is xxxxxxxxx.

Run the following command to set user joe as the system administrator:

openGauss=# GRANT ALL PRIVILEGES TO joe;

Run the GRANT command to set related permissions. For details, see GRANT.

Note: For details about how to create database accounts, see and Users and Permissions.