This topic describes how to create a database in Hologres using the management console and the psql client.
Prerequisites
You have purchased a Hologres instance. For more information, see Purchase a Hologres instance.
Background information
After you purchase a Hologres instance, the system automatically creates the postgres database. This database has limited resources and is used only for management. You must create a new database for business development.
Only a superuser or an account with permission to create databases can create a database.
Create a database in the Hologres management console
Go to the Hologres console. In the navigation pane on the left, click Instances.
On the Instances page, click the name of the instance.
You can also click Manage in the Actions column of the target instance to open the instance details page.
In the navigation pane on the left of the instance details page, click Database Management.
On the DB Authorization page, click Create Database in the upper-right corner.
In the Create Database dialog box, select an Instance Name, enter a Database Name, and select an Access Policy. We recommend that you select the SPM policy.
Policy Classification
Policy Description
Simple permission model (SPM)
This permission model grants permissions at the database (DB) level. It defines four roles: admin, developer, writer, and viewer. Use a few permission management functions to manage permissions on objects in the DB easily and securely. For more information, see Simple permission model (SPM).
Schema-level permission model (SLPM)
This permission model grants permissions at the schema level. It defines roles such as <db>.admin, <db>.<schema>.developer, <db>.<schema>.writer, and <db>.<schema>.viewer. This model provides more fine-grained permission control than the simple permission model. For more information, see Schema-level permission model (SLPM).
Expert Model
This model is identical to the standard PostgreSQL authorization model. For more information, see Standard PostgreSQL authorization model.
Click Confirm.
You can view the new database on the DB Authorization page.
Create a database from the psql client
Connect to your Hologres instance from the psql client. For more information, see PSQL client.
Create a database. The following is a sample SQL statement.
CREATE Database NewDatabaseName; CREATE Database test; -- Creates a database named test.Run the
\lcommand to display all databases in the current instance.Run the
\c NewDatabaseNamecommand to connect to the new database. Replace NewDatabaseName with the name of your database.
What to do next
You can use standard PostgreSQL statements in the psql client to perform data development. For example, you can import data from MaxCompute. For more information, see Import data from MaxCompute using SQL.
You can also use HoloWeb to perform data development. For more information, see Connect to HoloWeb and perform queries.