Create a database in a PolarDB-X instance to organize data, control access at the database level, and set the partitioning mode for Enterprise Edition instances.
Prerequisites
Before you begin, ensure that you have:
A PolarDB-X instance
(Optional) A standard account to assign to the database. The privileged account has full permissions on all databases by default and does not need to be assigned. If no standard account exists, create one — see Create an account
(Enterprise Edition only) A decision on whether to use AUTO mode or DRDS mode — see Databases in AUTO mode and DRDS mode
Create a database
Log on to the PolarDB-X console.
In the top navigation bar, select the region where the instance is deployed.
On the Instances page, click the PolarDB-X 2.0 tab.
Find the instance and click the instance ID.
In the left-side navigation pane, choose Configuration Management > Database Management.
In the upper-left corner of the Database Management page, click Create Database.
In the dialog box, configure the following parameters.
Parameter Description Example Database name 2–32 characters. Allowed characters: lowercase letters, digits, and underscores ( _). Must start with a lowercase letter and end with a lowercase letter or digit. Must be unique within the instance. The nametestis reserved and cannot be used.mydb_01Supported character set The character set for the database. Options: utf8,gbk,latin1,utf8mb4.utf8mb4Authorized account The standard account to grant access to this database. The privileged account already has full access to all databases and does not appear in this list. — Account permissions The permissions to grant to the selected account. Options: Read and Write, Read Only, DDL Only, DML Only. Read and WriteMode The database mode. Available only for Enterprise Edition instances. Options: AUTO or DRDS. See Mode options below. AUTODescription A description to help identify the database. Maximum 256 characters. — Click OK.
Mode options
The Mode parameter is available only for Enterprise Edition instances.
| Mode | Partitioning behavior | When to use |
|---|---|---|
| AUTO | Manual partitioning by default. Run SET GLOBAL AUTO_PARTITION=TRUE; to enable automatic partitioning — PolarDB-X then distributes data evenly across partitions without requiring a partition key. | General use; recommended for most workloads |
| DRDS | Manual partitioning only. Automatic partitioning is not supported. Specify a database shard key and a table shard key using PolarDB-X sharding syntax. If no shard key is specified, a non-partitioned table is created. | Workloads that require explicit control over sharding logic |
For more information, see Databases in AUTO mode and DRDS mode.
What's next
After the database is created, you can connect to it using the authorized account or manage account permissions from Configuration Management > Database Management.