After a PolarDB-X 1.0 database is created, you must create tables. This topic describes how to create a PolarDB-X 1.0 table.

  1. Log on to the PolarDB-X 1.0 console.
  2. In the top navigation bar, select the region where the target instance is located.
  3. Find the target instance and click the instance ID to go to the Basic Information page.
  4. In the left-side navigation pane, click Database Management.
  5. On the Databases page, find the target database and click the database ID to go to the Basic Information page.
  6. In the VPC Address area, find the Command Line Link Address, which contains the PolarDB-X 1.0 connection string.
  7. After you obtain the PolarDB-X 1.0 connection string, you can use the following MySQL command to establish a connection to the PolarDB-X 1.0 database:
    mysql -h${DRDS_ENDPOINT} -P${DRDS_PORT} -u${user} -p${password} -D${DRDS_DBNAME}
    Note The PolarDB-X 1.0 instance is a dedicated instance, and only the internal endpoint is provided by default. Therefore, we recommend that you install the MySQL command line on an Elastic Compute Service (ECS) instance that is in the same region as the PolarDB-X 1.0 instance.
  8. Execute the following statement to create a table:
    //DRDS DDL
    CREATE TABLE shard_table(
      id int,
      name varchar(30),
      primary key(id)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8 dbpartition by hash(id) tbpartition by hash(id) tbpartitions 3;