All Products
Search
Document Center

PolarDB:Create a database

Last Updated:Feb 18, 2025

This topic describes how to create a database in a PolarDB-X instance.

Procedure

  1. Log on to the PolarDB-X console.

  2. In the top navigation bar, select the region where the instance is deployed.

  3. On the Instances page, click the PolarDB-X 2.0 tab.

  4. Find the instance that you want to manage and click the instance ID.

  5. In the left-side navigation pane of the instance details page, choose Configuration Management > Database Management.

  6. In the upper-left corner of the Database Management page, click Create Database.

  7. In the dialog box that appears, configure the parameters that are described in the following table.

    Parameter

    Description

    Database Name

    The database name.

    Note

    The database name must meet the following requirements:

    • The name must be 2 to 32 characters in length and can contain lowercase letters, digits, and underscores (_).

    • The name must start with a lowercase letter and end with a lowercase letter or a digit.

    • The name must be unique within the instance.

    • The name cannot be 'test' because 'test' is a reserved keyword.

    Supported Character Set

    You can select utf8, gbk, latin1, or utf8mb4.

    Authorized Account

    The account that you want to use to log on to the database.

    Note
    • Only standard accounts are available in the drop-down list. The privileged account of an instance has all permissions on all databases in the instance. You do not need to authorize the privileged account to access a database.

    • If no standard accounts are available, you can click Create Account to create a standard account. For more information, see Create an account.

    Account Permissions

    The permissions that you want to grant to the specified account. You can select Read and Write, Read Only, DDL Only, or DML Only.

    Mode

    You can select AUTO or DRDS. This parameter is available only if the PolarDB-X instance is of Enterprise Edition and is not available if the PolarDB-X instance is of Standard Edition.

    • AUTO: Manual partitioning is used by default. You can execute the SET GLOBAL AUTO_PARTITION=TRUE; command to enable automatic partitioning. After that, you do not need to specify a partition key when you create a table. Data in the table is automatically evenly distributed among partitions.

    • DRDS: Manual partitioning is used by default. Automatic partitioning is not supported for databases in DRDS mode. When you create a table, you can use the sharding syntax that is dedicated to PolarDB-X to specify a database shard key and a table shard key. If no database shard key or table shard key is specified, a non-partitioned table is created.

    For more information, see Databases in AUTO mode and DRDS mode.

    Description

    The database description. The description can help you identify the database. The description can be up to 256 characters in length.

  8. Click OK.