Create data tables with ApsaraDB RDS
In the ApsaraDB RDS console, create a MySQL database instance and two data tables. One table stores the raw temperature data reported by devices, and the other stores temperature data that has been processed by a service application.
Prerequisites
You must complete the following operations:
This topic uses a virtual device as an example, but you can use any development method appropriate for your use case.
Procedure
-
Log on to the ApsaraDB RDS console.
-
On the Cloud DB Management page, click Create Instance to create a MySQL database instance.
-
In the database instance list, click Manage for the instance that you created.
-
In the left-side navigation pane, click Account Management to create a database user account and password. You will use these credentials to log on to the database. For details, see Create an account.
-
In the left-side navigation pane, click Database Management to create a database.
-
In the left-side navigation pane, click Whitelist and Security Group to add an IP address whitelist for the database. For details, see Set an IP address whitelist.
-
In the left-side navigation pane, click Basic Information to view the details of the database instance.
The Basic Information page shows the instance configuration, including the instance ID, instance name, resource group, region and zone, type and series (such as a general-purpose instance of the high-availability edition), network type (Virtual Private Cloud (VPC)), storage type (local SSD), and architecture (X86). The Instance Distribution section shows the number of read-only instances, disaster recovery instances, analysis instances, and emergency instances. You can click Add to scale out.
-
At the top of the page, click Log On to Database and enter your user account and password.
-
In the left-side navigation pane of Data Management (DMS), select the database that you created. In the database, create two data tables named sensor_data and maxtemperature. The
sensor_datatable stores temperature data reported by devices, and themaxtemperaturetable stores data that has been processed by the service application. The maxtemperature table contains four columns:id(bigint, length 50),deviceName(varchar, length 32),maxTemperature(float), anddateTime(varchar, length 32). The sensor_data table contains four columns:id(bigint, length 50),deviceName(varchar, length 32),temperature(float), anddateTime(varchar, length 32). All columns allow null values.
-
For more information about DMS, see Data Management (DMS).
-
For more information about ApsaraDB RDS, see ApsaraDB RDS for MySQL.