Manage self-managed databases on ECS with DMS

Updated at:

A self-managed database on an ECS instance is a database that you install and configure on the ECS instance. You can use Data Management (DMS) to manage self-managed databases on ECS instances in a one-stop manner, covering global data asset management, data governance, database design and development, data integration, data development, and data consumption. This topic uses MySQL as an example to describe how to use DMS to add and manage a self-managed database on an ECS instance.

Prerequisites

  • Data Management Service (DMS) is activated. For more information, see DMS.

  • An inbound security group rule allows traffic on port 3306 (default MySQL port). See Add a security group rule.

  • MySQL is installed on the ECS instance. See Deploy a MySQL database.

Procedure

  1. (Optional) If MySQL does not allow remote logon from the root account, you must create a non-root account for the MySQL database.

    We recommend that you use a non-root account to log on to the database. In this example, run the following commands to create an account named dmsTest with the password Ecs@123**** for the MySQL database and grant all privileges to the account.

    1. Connect to the ECS instance. See Connect to a Linux instance by using a password or key.

    2. Log on to MySQL with the root account:

      sudo mysql -uroot -p
    3. Run the following commands in sequence to create an account for remote logon to MySQL and allow remote hosts to use the account to access MySQL.

      In this example, the account is dmsTest and the password is Ecs@123****.

      Note

      When you actually create the account, replace the example password Ecs@123**** with a password that meets the requirements, and keep the password confidential. Password requirements: The password must be 8 to 30 characters in length and must contain uppercase letters, lowercase letters, digits, and special characters. The following special characters are supported:

      ()~!@#$%^&*-+=|{}[]:;'<>,.?/

      # Create an account named dmsTest and grant the remote connection permissions to the account. 
      create user 'dmsTest'@'%' identified by 'Ecs@123****'; 
      # Grant all permissions on MySQL to the dmsTest account. 
      grant all privileges on *.* to 'dmsTest'@'%'; 
      # Refresh the permissions. 
      flush privileges; 
    4. Exit MySQL:

      exit
  2. Use DMS to remotely access the MySQL database.

    1. Log on to the DMS console.

    2. In the top menu bar, click Instances.

    3. On the Instances tab, click Add.

    4. In the Add Instance dialog box, configure the self-managed database parameters.

      The following table describes the parameters. See Register a database hosted on a third-party cloud service or a self-managed database.

      Parameter

      Description

      Data Source

      Select Third-party Cloud/Self-managed.

      Relational Database

      The type of the self-managed database on the ECS instance. In this example, select MySQL.

      Basic Information

      Database Type

      Select MySQL.

      Instance Source

      Select ECS-hosted self-managed instance.

      Instance Region

      The region of the ECS instance. In this example, select China (Hangzhou).

      ECS Instance ID

      Click the drop-down list and select the target ECS instance.

      Port

      The port on which the database on the ECS instance listens. In this example, set the MySQL port to 3306.

      Access Method

      In this example, select Security Hosting - Manual to enable security hosting. For more information, see Security hosting.

      Database Account

      The account of the self-managed database on the ECS instance. In this example, the MySQL account is dmsTest.

      Note

      We recommend that you use a non-root account.

      Database password

      The password of the self-managed database account. In this example, the password of the dmsTest account is Ecs@123****.

    5. After configuring the parameters, click Test Connection in the lower-left corner.

      Note

      If the connection test fails, check the instance information based on the error message.

    6. After the Connection succeeded message appears, click OK.

      The database is now successfully registered with DMS. You can view and manage your database in the instance list on the left side of the DMS console.