Creating a GaussDB(DWS) Database and User
The default database gaussdb of GaussDB(DWS) is not used as the customer's service database. You can use multiple databases to ensure service isolation. When you first connect to gaussdb as the system administrator (dbadmin), it is important to plan the service databases, users, and roles based on the service requirements. This involves creating a service and transferring any existing upstream service data to GaussDB(DWS).
A role is a set of permissions. For details about the relationship between users and roles, see Permissions Management in the Developer Guide. You can create common roles, such as a role for database creation, before creating a user. Then, you can assign the created role to the user.
Users, roles, and permissions can be exported. For details, see Exporting a User, Exporting User Permissions, Exporting Roles, and Exporting Role Permissions.
Creating a Database
You can use the DDL syntax or SQL editor to create a table.
- DDL syntax: For details about the syntax, see "CREATE DATABASE".
- SQL editor: For details, see Using the SQL Editor to Connect to a GaussDB(DWS) Cluster.
Creating a Role
- Log in to the GaussDB(DWS) console. In the navigation pane on the left, choose Dedicated Clusters > Clusters.
- In the cluster list, click the name of the target cluster. The Cluster Information page is displayed.
- In the navigation pane on the left, choose User Management.
- Click Roles and click Create Role. The role creation page is displayed.
- Configure role information. The parameters are described as follows:
Table 1 Parameters for configuring role information Parameter
Description
Example Value
Role Name
The value must start with a letter and can contain a maximum of 63 characters, including letters, digits, and underscores (_).
dws-demo
Expires
Expiration time of the role permissions.
-
System Administrator
Whether the role has the system administrator rights.
-
Create Database
Whether the role has the permission to create databases.
-
Create Role
Whether the role has the permission to create users and roles.
-
Inherit Permissions
Whether the role inherits the permissions from its role group. By default, this function is enabled and it is best to keep it that way.
-
- Confirm the settings and click Next.
- Configure the permissions of the role.
Click Add to add a permission configuration. Select the database object type and the corresponding objects. Then, select permissions. For details about permission definitions, see "DCL Syntax" > "GRANT" in GaussDB(DWS) SQL Overview.
- After the authorization is complete, click Create.
Creating a Database User
You can use the DDL syntax or create a table on the GaussDB(DWS) console. For details about the DDL syntax, see "CREATE USER".
- If the current console does not support this feature, contact technical support.
- After a cluster is created, the users or roles created with it cannot be modified.
- Before using this function, ensure that the cluster is available.
- Log in to the GaussDB(DWS) console. In the navigation pane, choose Dedicated Clusters > Clusters.
- In the cluster list, click the name of the target cluster. The Cluster Information page is displayed.
- In the navigation pane, choose User Management.
- On the Users page, click Create User.
- Set the parameters on the Configure Basic Settings page.
Table 2 Parameters on the Configure Basic Settings page Parameter
Description
Example Value
Username
The value must start with a letter and can contain a maximum of 63 characters, including letters, digits, and underscores (_).
Dws-demo
Password
Enter a value that is 12 to 32 characters long and can contain letters, digits, underscores (_), and special characters.
NOTE:Your password must contain a minimum of three of the following character types: uppercase letters, lowercase letters, digits, and special characters (~!?,.:;_(){}[]/<>@#%^&*+|\=-)
-
Maximum Connections
Maximum number of connections between the user and the database. The value –1 indicates that the number of connections is not limited.
–1
Expires
Expiration time of the user's permissions.
-
System Administrator
Whether the user is a system administrator.
-
Create Database
Whether the user has the permission to create databases.
-
Create Role
Whether the user has the permission to create users and roles.
-
Inherit Permissions
Whether the user inherits permissions from its user group. By default, this function is enabled and it is best to keep it that way.
-
- Confirm the settings and click Next.
- On the Configure Roles page, select the role to be assigned to the user and click Next.
- Configure permissions not included in the roles of the user.
Click Add to add a permission configuration. Select the database object type and corresponding database object, and select the permission to complete assignment. For details about permission definitions, see "DCL Syntax" > "GRANT" in GaussDB(DWS) SQL Overview.
- After the authorization is complete, click Create.
Modifying a User
- Log in to the GaussDB(DWS) console. In the navigation pane, choose Dedicated Clusters > Clusters.
- In the cluster list, click the name of the target cluster. The Cluster Information page is displayed.
- In the navigation pane, choose User Management.
- In the user list, select a user and click Modify. The page for modifying user details is displayed.
- Modify the user information. For details, see Table 2. After confirming that the information is correct, click Next.
- Select the role you want to grant to the user and click Next.
- After selecting a permission type, you can click Edit in the Operation column and click Modify in the Permission column to add or remove a permission.
- Confirm the permissions. Click Save.
Deleting a User
Prerequisites
To prevent any problems with deleting a user, check for dependencies between database objects (such as tables) beforehand. If there are any dependencies, delete them first before proceeding with the user deletion.
Procedure
- Log in to the GaussDB(DWS) console. In the navigation pane, choose Dedicated Clusters > Clusters.
- In the cluster list, click the name of the target cluster. The Cluster Information page is displayed.
- In the navigation pane, choose User Management.
- Select a user from the user list and click Delete. A confirmation dialog box is displayed.
- Click OK.
Exporting a User
- Log in to the GaussDB(DWS) console. In the navigation pane, choose Dedicated Clusters > Clusters.
- In the cluster list, click the name of the target cluster. The Cluster Information page is displayed.
- In the navigation pane, choose User Management.
- Click Export in the upper part of the user list and select the number of records to be exported to export the user list.
Figure 1 Exporting a user
- Confirm the configurations and click Export.
Exporting User Permissions
- Log in to the GaussDB(DWS) console. In the navigation pane, choose Dedicated Clusters > Clusters.
- In the cluster list, click the name of the target cluster. The Cluster Information page is displayed.
- In the navigation pane, choose User Management.
- Select a user from the user list and click Export Permissions to export the user permission list.
Figure 2 Exporting permissions
Modifying a Role
- Log in to the GaussDB(DWS) console. In the navigation pane, choose Dedicated Clusters > Clusters.
- In the cluster list, click the name of the target cluster. The Cluster Information page is displayed.
- In the navigation pane, choose User Management.
- In the role list, select a user and click Modify. The page for modifying role details is displayed.
- Modify the role information. For the parameter description, see Table 1.
- Confirm the settings and click Next.
- Configure permissions. Select a permission type as required, click Edit in the Operation column, and click Modify in the Permission column to add or remove permissions.
- Confirm the permissions. Click Save.
Deleting a Role
Prerequisites
To prevent any problems with deleting a role, check for dependencies such as database objects beforehand. If there are any dependencies, delete them first before proceeding with the role deletion.
Procedure
- Log in to the GaussDB(DWS) console. In the navigation pane, choose Dedicated Clusters > Clusters.
- In the cluster list, click the name of the target cluster. The Cluster Information page is displayed.
- In the navigation pane, choose User Management.
- Select a role from the role list and click Delete. A confirmation dialog box is displayed.
- Click OK to delete the role.
Exporting Roles
- Log in to the GaussDB(DWS) console. In the navigation pane, choose Dedicated Clusters > Clusters.
- In the cluster list, click the name of the target cluster. The Cluster Information page is displayed.
- In the navigation pane, choose User Management and click Roles to switch to the role list page.
- Click Export in the upper part of the role list and select the number of roles to be exported.
Figure 3 Exporting roles
- Confirm the information and click Export.
Exporting Role Permissions
- Log in to the GaussDB(DWS) console. In the navigation pane, choose Dedicated Clusters > Clusters.
- In the cluster list, click the name of the target cluster. The Cluster Information page is displayed.
- In the navigation pane, choose User Management and click Roles to switch to the role list page.
- Select a user from the role list, click Export Permissions, and select the number of records to be exported.
Figure 4 Exporting role permissions
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot