This topic describes how to create a database in Hologres using the management console or a psql client.
Prerequisites
-
A Hologres instance has been activated. For more information, see Purchase a Hologres instance.
-
Only a Superuser or an account that has permissions to create databases can create a database.
Background information
After you purchase a Hologres instance, the system automatically creates the postgres database. This database is allocated few resources and is used only for management purposes. For business development, create a new database.
Create a database in the Hologres management console
-
Go to the Hologres management console. In the left navigation pane, click Instances.
-
On the Instances page, click the instance name.
Alternatively, click Manage in the Actions column of the target instance to go to the instance details page.
-
In the left navigation pane 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 Permission Model as needed. We recommend that you select SPM.
Policy Classification
Policy Description
Simple permission model (SPM)
This permission model grants permissions at the DB level. It defines four roles: admin, developer, writer, and viewer. You can use a few permission management functions to manage permissions on objects in the DB in a convenient and secure manner. For more information, see Simple permission model (SPM).
Schema-level simple permission model (SLPM)
This permission model grants permissions at the schema level. It defines four roles: <db>.admin (DB administrator), <db>.<schema>.developer, <db>.<schema>.writer, and <db>.<schema>.viewer. This model provides more fine-grained control than the simple permission model. For more information, see Schema-level simple permission model (SLPM).
expert model
This model is identical to the PostgreSQL permission model. For more information, see Standard PostgreSQL authorization model.
-
Click OK.
You can view the created database on the DB Authorization page.
Create a database using a psql client
-
Connect your Hologres instance to a psql client. For more information, see Connect to a Hologres instance from a psql client.
-
Create a database by running the following SQL statement:
CREATE Database NewDatabaseName; CREATE Database test; -- This is an example of creating 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 actual name of your database.
What to do next
You can use standard PostgreSQL statements in the psql client for data development. For example, you can import data from MaxCompute using SQL.
You can also use HoloWeb for data development. For more information, see Connect to HoloWeb and run a query.