MySQL connection type

更新时间:
复制 MD 格式

EventBridge uses MySQL connections to integrate MySQL databases with the EventHouse Data Catalog, enabling SQL queries on MySQL tables as event tables.

Overview

A MySQL connection establishes connectivity between EventBridge and a MySQL database. After you create the connection, you can mount it in the EventHouse Data Catalog to map MySQL tables as queryable event tables.

Supported MySQL instances:

  • Alibaba Cloud ApsaraDB RDS for MySQL (version 5.7 and later, 8.0 recommended)

  • Alibaba Cloud PolarDB for MySQL

  • Self-managed MySQL instances

Connection parameters

Parameter

Field name

Type

Required

Description

Host address

HostName

string

Yes

The MySQL host address. For RDS instances, enter the instance endpoint (such as rm-xxx.mysql.rds.aliyuncs.com). For self-managed instances, enter the IP address.

Port number

Port

string

Yes

The MySQL port number. Default: 3306.

Username

User

string

Yes

The database username. We recommend that you use a read-only account.

Password

Password

string

Yes

The database password.

Database name

DatabaseName

string

Yes

The name of the database to connect to.

Parameter example

{
  "HostName": "rm-bp1xxxxx.mysql.rds.aliyuncs.com",
  "Port": "3306",
  "User": "readonly_user",
  "Password": "your_password",
  "DatabaseName": "order_db"
}

Create a MySQL connection

Create a connection in the console

  1. Log on to the EventBridge console.

  2. In the left-side navigation pane, choose Integration Center > Connection Management.

  3. In the top navigation bar, select a region and click Create Connection.

  4. Select MySQL as the connection type and configure the connection parameters.

  5. Click Test Connection to verify connectivity.

  6. After the test is passed, click OK.

Create a connection by calling an API operation

Call the CreateConnection API operation to create a MySQL connection:

{
  "ConnectionName": "my-mysql-conn",
  "Type": "MySQL",
  "Parameters": {
    "HostName": "rm-bp1xxxxx.mysql.rds.aliyuncs.com",
    "Port": "3306",
    "User": "readonly_user",
    "Password": "your_password",
    "DatabaseName": "order_db"
  }
}

Network configuration

Network type

Description

Scenario

Internet

Connect over the Internet. No additional configuration required.

The MySQL instance has Internet access enabled (for RDS, enable the public endpoint).

VPC

Connect over a VPC.

The MySQL instance is deployed in a VPC.

VPC connections require the following additional parameters:

  • VPC ID: The VPC where the MySQL instance is located.

  • vSwitch ID: A vSwitch in the VPC.

  • Security group ID: The inbound rules of the security group must allow access to the MySQL port (3306).

EventBridge automatically establishes network connectivity with your VPC. No additional network configuration is required.

Usage scenarios

Catalog mount (supported)

Mount a MySQL connection to an EventHouse Catalog to query MySQL tables directly with SQL:

-- Query an orders table in MySQL
SELECT * FROM my_catalog.order_namespace.orders LIMIT 10;

-- Cross-source JOIN: MySQL orders table and EventHouse event table
SELECT o.order_id, o.amount, e.event_type
FROM my_catalog.order_namespace.orders o
JOIN my_catalog.event_namespace.payment_events e
  ON o.order_id = e.order_id;

For more information, see Data catalog.

Permission requirements

Create a dedicated read-only account for EventBridge:

-- Create a read-only user
CREATE USER 'eb_readonly'@'%' IDENTIFIED BY 'your_password';
-- Grant read-only permissions
GRANT SELECT ON order_db.* TO 'eb_readonly'@'%';
FLUSH PRIVILEGES;

EventBridge only requires SELECT permissions and does not modify data in MySQL.

FAQ

Q: The connection test failed with "Connection refused".

A: Check the following:

  • Whether the MySQL instance is running properly.

  • Whether the host address and port are correct. Check whether the RDS instance uses an internal or public endpoint.

  • Whether the whitelist or security group allows access to port 3306.

  • If you use a VPC connection, verify that the VPC and vSwitch are configured correctly.

Q: The connection test succeeded, but the query after mounting reports "Access denied".

A: The connection test only verifies network connectivity and basic authentication. Queries require the user to have SELECT permissions on the target tables. Verify that the authorization scope covers the tables you want to query.

Q: Can I modify the parameters after creating a connection?

A: You can modify the host address, port, username, password, and database name. The connection name and type cannot be modified after creation.