Updated on 2023-10-18 GMT+08:00

Connecting to a DB Instance from a Windows ECS

If your DB instance and ECS are not in the same region or VPC, you can connect to your DB instance using a Windows client through an EIP.

This section describes how to connect to a DB instance using a Windows ECS with the MySQL-Front client installed through an EIP.

  1. Binding an EIP to a DB Instance
  2. Querying the EIP of the DB Instance to Be Connected
  3. Testing Connectivity and Installing MySQL-Front
  4. Using MySQL-Front to Connect to a DB Instance

Purchasing an ECS

  1. Log in to the management console and check whether there is an ECS available.

  2. Buy an ECS and select Windows as its OS.

    To download a MySQL client to the ECS, bind an EIP to the ECS.

    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, view the region and VPC of the ECS.

  4. On the Basic Information page of the GaussDB(for MySQL) DB instance, view the region and VPC of the DB instance.

Binding an EIP to a DB Instance

You can bind an EIP to a DB instance for public accessibility and can unbind the EIP from the DB instance if needed.

If an EIP has been bound to the DB instance, skip this step.

For details, see Binding an EIP.

  1. Log in to the management console.
  2. Click in the upper left corner and select a region and a project.
  3. Click in the upper left corner of the page, choose Database > GaussDB(for MySQL).
  4. On the Instances page, click the instance name to go to the Basic Information page.
  5. In the Network Information area, click Bind in the Public IP Address (EIP) field.
  6. In the displayed dialog box, select an EIP and click OK.

    If no EIPs are available, click View EIP to create an EIP on the network console. After the EIP is created, go back to the Basic Information page and bind the newly created EIP to the instance.

    You need to configure security group rules and enable specific IP addresses and ports to access the DB instance. For details, see Configuring Security Group Rules.

  7. In the Public IP Address (EIP) field of the Network Information area, view the EIP that was bound.

Querying the EIP of the DB Instance to Be Connected

  1. Log in to the management console.
  2. Click in the upper left corner and select a region and a project.
  3. Click in the upper left corner of the page, choose Database > GaussDB(for MySQL).
  4. On the Instances page, click the instance name to go to the Basic Information page.
  5. In the Network Information area, obtain the EIP and database port.

Testing Connectivity and Installing MySQL-Front

  1. Open the cmd window on your local server and check whether the EIP and database port of the DB instance can be connected.

    telnet EIP port

    Example:

    telnet 192.168.0.16 3306

    If the message "command not found" is displayed, install the Telnet tool based on the OS used by the ECS.

    • If yes, network connectivity is available.
    • If no, check the security group rules.
      • If Destination is not 0.0.0.0/0 and Protocol & Port is not All on the Outbound Rules page of the ECS, add the EIP and port of the DB instance to the outbound rules.
      • To view the inbound rules of the GaussDB(for MySQL) security group, add the EIP and port of the ECS to the inbound rules. For details, see Configuring Security Group Rules.

  2. Open a browser, and download and install the MySQL-Front tool locally (version 5.4 is used as an example).

Using MySQL-Front to Connect to a DB Instance

  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

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

    Host

    EIP obtained in 5.

    Port

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

    User

    Account name of the DB instance. The default value 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 is successfully connected.

    Figure 3 Opening a session