This topic describes how to create a database in the Hologres console or from the PostgreSQL client.
A Hologres instance is purchased. For more information, see Purchase a Hologres instance.
After you purchase a Hologres instance, a database named postgres is created by default. This database is allocated with a few resources and only used for management purposes. We recommend that you create a database based on your business needs.
Only a superuser or a user granted with the database creation permission can create a database.
Create a database in the Hologres console
- Log on to the Hologres console.
- In the left-side navigation pane, click Instances. On the Hologres Instances page, click the name of the purchased instance. The instance details page appears.You can also click Manage in the Actions column of the target instance to go to the instance details page.
- In the left-side navigation pane of the instance details page, click Databases.
- On the Databases tab, click Create Database.
- In the Create Database dialog box, enter a database name in the Database Name field and specify whether to enable the simple permission model (SPM) by setting
the SPM parameter based on your business needs.
Hologres allows you to use the standard PostgreSQL authorization model or SPM for the management of user permissions.
Compatible with PostgreSQL, Hologres uses a permission model that is exactly the same as the standard PostgreSQL authorization model. For more information, see Grant permissions by using the standard PostgreSQL authorization model.
Backed by its understanding of customers' business and its practical experience, Alibaba Cloud introduced the SPM to Hologres to simplify the management of user permissions. For more information, see SPM Overview.
If you want to simplify permission management, we recommend that you set SPM to Enable when you create a database.
- Click OK.After the database is created, it appears on the Databases tab.
Create a database from the PostgreSQL client
- Connect to the target Hologres instance from the PostgreSQL client. For more information, see Connect to a Hologres instance from the PostgreSQL client.
- Execute the following SQL statement to create a database:
CREATE Database NewDatabaseName; CREATE Database test; // Create a database named test.
- Run the
\lcommand to view the databases in the current instance.
- Run the
\c NewDatabaseNamecommand to connect to the created database. Replace NewDatabaseName with the name of the created database when you run this command.
What to do next
You can also use HoloStudio in DataWorks or HoloWeb for data analytics. For more information, see Overview or Quick start.