Create a database

更新时间:
复制 MD 格式

PolarDB-X 1.0 supports two storage classes: RDS for MySQL (private) and PolarDB for MySQL. This topic describes how to create a database for each storage class in the PolarDB-X 1.0 console.

Prerequisites

You must create an instance before you can create a database.

Note
  • The storage class that you select when you create an instance determines the storage class that you can use when you create a database. For example, if you select RDS MySQL when you create an instance, the storage class is set to RDS for MySQL and cannot be changed when you create a database.
  • PolarDB-X 1.0 storage layer, a private, customized RDS, is tightly integrated with the compute layer instances of PolarDB-X 1.0 to provide superior performance and more stable service links. We recommend that you select the RDS for MySQL storage class. For more information, see Overview.

Create a database that uses the RDS for MySQL storage class

  1. Log on to the PolarDB-X 1.0 console.

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

  3. Find the instance and click the instance ID to go to the Basic Information page.

  4. On the Basic Information page of the instance, click Create Database in the upper-right corner.
  5. In the dialog box that appears, select a Partition Mode and set the parameters as needed.
    • If you select Horizontal Splitting for Partition Mode, perform the following steps:
      1. On the Fill in Basic Information page, set the following parameters and click Next.
        ParameterDescription
        Partition ModeSelect Horizontal Splitting.
        Note PolarDB-X 1.0 can split data into multiple databases and tables based on sharding rules. Horizontal splitting lets you scale out your database and linearly increase the overall storage capacity and concurrent throughput.
        Storage classThe storage class is the same as the one you selected when you created the PolarDB-X 1.0 compute resource instance. In this topic, RDS MySQL was selected when the PolarDB-X 1.0RDS MySQL and does not need to be selected.
        Database NameEnter a database name.
        Note The database name must meet the following requirements:
        • It must consist of lowercase letters, digits, and underscores (_).
        • It must start with a letter and be no more than 24 characters in length.
        Character SetSet the character set to uft8, gbk, latin1, or uft8mb4.
        Connection PasswordEnter the password for the database connection.
        Note The password must meet the following requirements:
        • The password must be 8 to 30 characters in length.
        • It must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and underscores (_).
        Confirm PasswordEnter the password again to confirm.
      2. On the Select RDS page, set the following parameters:
        • If you have not purchased any private RDS instances, click the link to purchase a private RDS instance and follow these steps to purchase a private RDS instance.
          1. Select PolarDB-X Storage Layer - Private RDS (Subscription) or PolarDB-X Storage Layer - Private RDS (Pay-As-You-Go) and set the following parameters:
            OptionDescription
            Region and ZoneSelect a region and zone to specify the physical location of the instance.
            Note The storage layer instance and the compute layer instance must be in the same region, but can be in different zones. For example, if the compute layer instance is in the China (Hangzhou) region, the storage layer instance is also fixed to the China (Hangzhou) region and does not need to be selected.
            MySQL VersionThe MySQL version of the storage layer instance must be the same as the MySQL version of the compute layer instance.
            Note
            • If the compute layer instance uses MySQL 8.0, the MySQL version of the storage layer instance is fixed to 8.0 and does not need to be selected.
            • If the compute layer instance uses MySQL 5, the MySQL version of the private custom RDS instance for the storage layer is fixed to 5.7 and does not need to be selected.
            SeriesSelect High Availability or Three-node Enterprise Edition.
            Storage ClassThis parameter is fixed to Local SSD and does not need to be selected.
            Network Type
            • If you select High Availability for Series, the network type is fixed to Classic Network and does not need to be selected.
            • If you select Three-node Enterprise Edition for Series, you can set Network Type to VPC or Classic Network.
            SpecificationsSelect the specifications to configure the number of CPU cores and memory size for the instance.
            Storage SpaceSelect the amount of storage space to purchase.
            QuantitySelect the number of instances to purchase.
            Subscription DurationSelect a subscription duration for the instance and specify whether to enable auto-renewal.
            Note This parameter is available only when you purchase a PolarDB-X Storage Layer - Private Custom RDS (Subscription) instance.
          2. Click Buy Now.
          3. On the Confirm Order page, confirm the product information, select the Terms of Service, and click Activate Now.
          4. After the activation is successful, the page automatically redirects to the Dry Run page.
        • If you have already purchased private RDS instances, follow these steps to configure them:
          1. Click Use Purchased Private RDS.
          2. Select the target RDS instance and click the 1 icon to move it from the box on the left to the box on the right.
          3. Click Next to go to the Dry Run page.
    • If you select Vertical Splitting for Partition Mode, set the following parameters and click Next.
    ParameterDescription
    Partition ModeSelect Vertical Splitting.
    Note
    • Import multiple existing databases from different private custom RDS instances in batches. Use instance-level accounts of PolarDB-X 1.0 for unified authorization management. A single PolarDB-X 1.0 connection lets you perform federated queries and transactional writes across databases on multiple private custom RDS instances.
    • Before you use vertical splitting, make sure that you have purchased private custom RDS instances by configuring Horizontal Splitting
    Storage ClassThe storage class is the same as the one you selected when you created the PolarDB-X 1.0 compute resource instance. For example, if you selected RDS MySQL when you created the PolarDB-X 1.0 compute resource instanceRDS MySQL and does not need to be selected.
    Add Database
    1. In the box for selecting private custom RDS instances, select the target private custom RDS instance.
    2. From the existing databases of the target private custom RDS instance, select the target database and click the 1 icon to move it to the box on the right.
    Character SetSet the character set to uft8, gbk, latin1, or uft8mb4.
    Account TypeSelect Create New Account or Select Existing Account.
    Database AccountEnter the name of the new account to create.
    Note This parameter is available only when you set Account Type to Create New Account.
    Connection PasswordEnter the password for the database connection.
    Note The password must meet the following requirements:
    • The password must be 8 to 30 characters in length.
    • It must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and underscores (_).
    Confirm PasswordEnter the password again to confirm.
    Note This parameter is available only when you set Account Type to Create New Account.
  6. On the Dry Run page, wait for the result to become Success, and then click Next.
  7. On the Database Creation Preview page, confirm the database information and click Next to create the database.
    Note When the partition mode is Horizontal Splitting, PolarDB-X 1.0 creates eight physical databases for each private RDS instance by default. In this case, on the Database Creation Preview page, the total number of physical sharded databases is eight times the number of selected private RDS instances.
  8. After the database is created, you can view it on the Database Management page. If you used vertical splitting, the new account is available on the Account Management page.

Create a database that uses the PolarDB for MySQL storage class

  1. Log on to the PolarDB-X 1.0 console.

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

  3. In the left-side navigation pane, click Instances.

  4. Find the instance and click the instance ID to go to the Basic Information page.

  5. On the Basic Information page of the instance, click Create Database in the upper-right corner.
  6. In the dialog box that appears, select a Partition Mode and set the parameters as needed.
    • If you select Horizontal Splitting for Partition Mode, perform the following steps:
      1. On the Fill in Basic Information page, set the following parameters and click Next.
        ParameterDescription
        Partition ModeSelect Horizontal Splitting.
        Note PolarDB-X 1.0 can split data into multiple databases and tables based on sharding rules. Horizontal splitting lets you scale out your database and linearly increase the overall storage capacity and concurrent throughput.
        Storage ClassThe storage class is the same as the one you selected when you created the PolarDB-X 1.0 compute resource instance. For example, if you selected PolarDB when you created the PolarDB-X 1.0 compute resource instance PolarDB for MySQL and does not need to be selected.
        Database NameEnter a database name.
        Note The database name must meet the following requirements:
        • It must consist of lowercase letters, digits, and underscores (_).
        • It must start with a letter and be no more than 24 characters in length.
        Character SetSet the character set to uft8, gbk, latin1, or uft8mb4.
        Connection PasswordEnter the password for the database connection.
        Note The password must meet the following requirements:
        • The password must be 8 to 30 characters in length.
        • It must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and underscores (_).
        Confirm PasswordEnter the password again to confirm.
      2. On the Select POLARDB page, set the following parameters:
        • If you have not purchased any PolarDB for MySQL clusters, click Purchase New POLARDB and follow these steps:
          1. Set Product Type to Subscription or Pay-As-You-Go.
            Note
            • Subscription: Pay for compute nodes (one primary node and one read-only node) when you create a cluster. Storage space is billed hourly based on the actual data volume. If you plan to use the cluster long-term, the subscription billing method is more cost-effective. Longer subscription durations offer greater discounts.
            • Pay-As-You-Go (billed by the hour): No upfront payment is required. Both compute nodes and storage space are billed hourly based on actual data volume. If you need a cluster for a short time, select the pay-as-you-go billing method. Release the cluster after use to save costs.
          2. Set the following parameters.
            OptionDescription
            RegionSelect a region and zone to specify the physical location of the PolarDB cluster.
            Note The storage layer PolarDB cluster and the compute layer PolarDB-X 1.0 instance must be in the same region, but can be in different zones. For example, if the compute layer PolarDB-X 1.0 instance is in the China (Hangzhou) region, the region for the storage layer PolarDB cluster is also fixed to China (Hangzhou) and does not need to be selected.
            Creation MethodThis parameter is fixed to Create Primary Cluster and does not need to be selected.
            Network TypeThis parameter is fixed to VPC and does not need to be selected.
            VPC and vSwitch
            • If you have a VPC that meets your network planning requirements, select that VPC. For example, if you have an ECS instance and its VPC meets your requirements, select that VPC.
            • If you do not have a suitable VPC, create a VPC and a vSwitch. For more information, see Create and manage a VPC.
            CompatibilityThe MySQL version of the storage layer PolarDB cluster must be the same as the MySQL version of the compute layer PolarDB-X 1.0 instance.
            Note
            • If the compute layer PolarDB-X 1.0 instance uses MySQL 8.0, the MySQL version of the storage layer PolarDB cluster is fixed to MySQL 8.0 and does not need to be selected.
            • If the compute layer PolarDB-X 1.0 instance uses MySQL 5, the MySQL version of the storage layer PolarDB cluster is fixed to MySQL 5.6 and does not need to be selected.
            SeriesThis parameter is fixed to Standard Edition and does not need to be selected.
            Node SpecificationsSelect the node specifications as needed. All nodes are of the Dedicated type, ensuring stable and reliable performance. For more information about the specifications, see Billing overview.
            Number of Nodes
            • The default number of nodes is 2 and does not need to be selected. The system automatically creates a read-only node with the same specifications as the primary node.
            • If the primary node fails, the system automatically promotes the read-only node to be the new primary node and creates a new read-only node.
            • For more information about read-only nodes, see Service architecture.
            Storage FeeThis parameter does not need to be selected. The system charges you on an hourly basis based on the actual data usage. For more information, see Product pricing.
            Note You do not need to select a storage capacity when you create a cluster. The storage capacity automatically scales with the data volume.
            Time ZoneSet the time zone for the cluster. The default time zone is UTC+08:00.
            Case-sensitive Table NamesSpecify whether table names in the cluster are case-sensitive. By default, table names are not case-sensitive. If your on-premises database is case-sensitive, you can select Case-sensitive to facilitate data migration.
            Note This parameter cannot be changed after the cluster is created. Select the option with caution.
            When Deleting (Releasing) a ClusterSet the backup retention policy for when the cluster is deleted (released). The default policy is Retain the last backup (auto-backup before release).
            • Retain the last backup (auto-backup before release): Retains the last backup when the cluster is deleted.
            • Retain all backups: Retains all backups when the cluster is deleted.
            • Do not retain backups (cannot be restored after release): Does not retain any backups when the cluster is deleted.
            Note Retaining backups when you delete (release) a cluster may incur minor fees. You can delete backups at any time to save costs.
            Resource GroupA resource group is a container that helps you manage a group of related resources under a single Alibaba Cloud account. You can map resource groups to concepts such as projects, applications, or organizations based on your business scenarios. For more information, see Resource groups and authorization.
            Subscription DurationSelect a subscription duration for the instance and specify whether to enable auto-renewal.
            Note This parameter is available only when you set Product Type to Subscription.
          3. Click Buy Now.
          4. On the Confirm Order page, confirm the product information, select the Terms of Service, and click Go to Payment.
          5. On the Payment page, confirm the order details and amount, and then click Order to activate the service.
          6. After the activation is successful, the page automatically redirects to the Dry Run page.
        • If you have already purchased PolarDB clusters, follow these steps to configure them:
          1. Click Use Existing POLARDB.
          2. Select the target PolarDB cluster and click the 1 icon to move it from the box on the left to the box on the right.
          3. Click Next to go to the Dry Run page.
    • If you select Vertical Splitting for Partition Mode, set the following parameters and click Next.
    ParameterDescription
    Partition ModeSelect Vertical Splitting.
    Note Import multiple existing databases from different PolarDB for MySQL clusters in batches. Use instance-level accounts of PolarDB-X 1.0 for unified authorization management. A single PolarDB-X 1.0 connection lets you perform federated queries and transactional writes across databases on multiple PolarDB for MySQL clusters.
    Storage classThis parameter defaults to the storage class that you selected when you created the PolarDB-X 1.0 compute resource instance. For example, if you selected PolarDBPolarDB-X 1.0 compute resource instance, the storage class is set to PolarDB for MySQL, and you do not need to select it.
    Add Database
    1. In the box for selecting PolarDB clusters, select the target PolarDB cluster.
    2. From the existing databases of the target PolarDB cluster, select the target database and click the 1 icon to move it to the box on the right.
    Character SetSet the character set to uft8, gbk, latin1, or uft8mb4.
    Account TypeSelect Create New Account or Select Existing Account.
    Database AccountEnter the name of the new account to create.
    Note This parameter is available only when you set Account Type to Create New Account.
    Connection PasswordEnter the password for the database connection.
    Note The password must meet the following requirements:
    • The password must be 8 to 30 characters in length.
    • It must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and underscores (_).
    Confirm PasswordEnter the password again to confirm.
    Note This parameter is available only when you set Account Type to Create New Account.
  7. On the Dry Run page, wait for the dry run to succeed, and then click Next.
  8. On the Database Creation Preview page, confirm the database information and click Next to create the database.
    Note When the partition mode is Horizontal Splitting, PolarDB-X 1.0 creates eight physical databases for each PolarDB cluster by default. In this case, on the Database Creation Preview page, the total number of physical sharded databases is eight times the number of selected PolarDB clusters.
  9. After the database is created, you can view it on the Database Management page. If you used vertical splitting, the new account is available on the Account Management page.