Create a MySQL tenant

更新时间:
复制 MD 格式

This tutorial shows how to create a MySQL-compatible tenant named tutorial_mysql. The tenant will have its resources distributed on a single node with 4 CPU cores and 16 GB of memory.

Concepts

An ApsaraDB OceanBase tenant is a complete database service that is compatible with both MySQL and Oracle. A tenant's service capabilities can be horizontally scaled across multiple machines, and it supports dynamic scale-out and scale-in. Tenants provide strong data protection and high availability, with features such as cross-cluster physical synchronization, physical backup, and recovery. Data in a tenant can include schema data, user table data, and transactional data.

OceanBase is a multi-tenant database system. It isolates resources between tenants to prevent resource contention and ensure stable business operations. A user created in a tenant can only log on to that specific tenant and is not visible to other tenants. Similarly, tables created in one tenant are not visible to others. This design provides a more secure database service and supports lightweight tenants and rapid tenant-level scaling.

In the same ApsaraDB OceanBase cluster, you can create one or more tenants that are compatible with MySQL or Oracle.

  • MySQL tenant: In the MySQL mode of OceanBase, a database is a collection of database objects. After you connect to a MySQL tenant, you can create databases to store and manage your data. For more information, see Create a MySQL database.

  • Oracle tenant: In the Oracle mode of OceanBase, a schema is a collection of database objects owned by a user. When a user is created, a default schema is assigned to the user, and the schema name is the same as the username. Unlike with MySQL tenants, you do not need to create a schema after connecting to an Oracle tenant. You can directly store and manage your data.image.png

Prerequisites

After you deploy a cluster instance in a zone, you must create a VPC and a vSwitch in the same zone to allow your application and the tenant to communicate over the network.

  1. Create a VPC. The zone of the VPC must be the same as the zone specified in Create a cluster instance. For more information, see Create and manage a VPC.

  2. Create a vSwitch. The zone of the vSwitch must be the same as the zone specified in Create a cluster instance. For more information, see Create and manage a vSwitch.

Note

Before you can use cloud resources in a Virtual Private Cloud (VPC), you must create a VPC and a vSwitch. You can create multiple vSwitches in a VPC to divide the VPC into subnets. By default, subnets within the same VPC can communicate with each other over the private network.

  • A Virtual Private Cloud (VPC) is a custom private network that you can create. Different VPCs are logically isolated from each other. You can create and manage cloud resources in your VPC.

  • A vSwitch is a basic network device within a VPC that connects different cloud resources. When you create a cloud resource in a VPC, you must specify the vSwitch to which the resource will be connected.

Procedure

  1. In the instance list, find Cluster Tutorial and click the cluster instance name to open the cluster instance workbench.

    image.png

  2. In the upper-right corner of the page, click Create Tenant.

  3. In the dialog box that appears, enter the tenant information:

    Configuration parameters

    Description

    Tenant Name

    tutorial_mysql

    Tenant Mode

    You can select MySQL mode

    Character Set

    Use the default value `utf8mb4_general_ci`. This is a MySQL character set where `utf8mb4` is the UTF-8 encoding for the Unicode character set.

    Number of Resource Units

    1

    CPU specifications

    4 cores

    Memory

    16 GB

    Time Zone

    Select the default time zone.

    Access VPC

    Select the VPC that you created in the Prerequisites section. For more information, see How to create a VPC and a vSwitch.

    Primary Zone

    Only a fixed zone is supported. The zone where the primary endpoint agent is deployed is the same as the primary zone by default. To change this, go to the topology diagram on the tenant's product page after the tenant is created.

    Access vSwitch

    Select the vSwitch that you created in the Prerequisites section. For more information, see How to create a VPC and a vSwitch.

  1. Click Create. You can monitor the creation progress on the instance list page.

What to do next

The tenant creation process takes about 5 minutes to complete.