nav-img
Advanced

Connecting to a DB Instance from a Windows ECS

After creating a DB instance, you can connect to it using a Windows ECS with a database client (for example, MySQL-Front) installed over a private network.

Operation Process

Process

Description

Purchase a Windows ECS that is in the same region and VPC as your DB instance.

Test the network connectivity between the ECS and the floating IP address and port of the DB instance, and install MySQL-Front on the ECS.

Use MySQL-Front to connect to the DB instance using the floating IP address and port.

Step 1: Create an ECS

  1. Log in to the management console and check whether there is an ECS available.
  2. Create an ECS and select Windows as its OS.

    To download a MySQL client to the ECS, bind an EIP to the ECS. The ECS must be in the same region, VPC, and security group as the RDS for MySQL DB instance for mutual communications.

    For details about how to purchase a Windows ECS, see "Purchasing an ECS" in Elastic Cloud Server User Guide.

  3. On the ECS Information page, check the VPC of the ECS.

  4. On the Basic Information page of the RDS for MySQL instance, check the VPC of the DB instance.
  5. Ensure that the ECS and RDS for MySQL instance are in the same region and VPC. Then go to Step 2: Test Connectivity and Install MySQL-Front.
    • If they are not in the same region, create another ECS or DB instance. The ECS and DB instance in different regions cannot communicate with each other. To reduce network latency, deploy your DB instance in the region nearest to your workloads.
    • If the ECS and DB instance are in different VPCs, change the VPC of the ECS to that of the DB instance. For details, see "Changing a VPC" in the Elastic Cloud Server User Guide.

Step 2: Test Connectivity and Install MySQL-Front

  1. Log in to the ECS. For details, see "Login Using VNC" in the Elastic Cloud Server User Guide.
  2. On the Instances page of the RDS console, click the DB instance name.
  3. Choose Connectivity & Security from the navigation pane. In the Connection Information area, obtain the floating IP address and database port of the DB instance.
  4. Open the cmd window on the ECS and check whether the floating IP address and database port of the DB instance can be connected.

    telnet 192.168.6.144 3306

    • If yes, network connectivity is normal.
    • If no, check the security group rules.
      • Check the outbound rules of the ECS security group. By default, all outgoing network traffic is allowed.

        If not all outgoing traffic is allowed, add an outbound rule for the floating IP address and port of the DB instance.

      • If in the security group of the DB instance, there is no inbound rule allowing the access from the private IP address and port of the ECS, add an inbound rule for the private IP address and port of the ECS. For details, see Configuring Security Group Rules.
  5. Open a browser, and download and install the MySQL-Front tool on the ECS (version 5.4 is used as an example).

Step 3: Connect to the DB Instance Using MySQL-Front

  1. Start MySQL-Front.
  2. In the displayed dialog box, click New.

    Figure 1 Connection management


  3. Enter the information of the DB instance to be connected and click Ok.

    Figure 2 Adding an account


    Table 1 Parameter description

    Parameter

    Description

    Name

    Name of the database connection task. If you do not specify this parameter, it will be the same as that configured for Host by default.

    Host

    Floating IP address obtained in 3.

    Port

    Database port obtained in 3. The default value is 3306.

    User

    Name of the user who will access the DB instance. The default user is root.

    Password

    Password of the account for accessing the DB instance.

  4. In the displayed window, select the connection that you have created in 3 and click Open. If the connection information is correct, the DB instance will be connected.

    Figure 3 Opening a session