MySQL

更新时间:
复制 MD 格式

Property definition

  • Data source type: mysql

  • Supported configuration modes (ConnectionPropertiesMode):

    • Connection string mode (UrlMode)

    • Instance mode (InstanceMode)

Current-account instance mode

Parameter

Type

Example

Required

Description

regionId

String

cn-shanghai

Yes

The ID of the region to which the instance belongs.

instanceId

String

rm-xxxxxxxxx

Yes

The instance ID.

database

String

mysql_database

Yes

The name of the database.

username

String

xxxxx

Yes

The username.

password

String

xxxxx

Yes

The password.

securityProtocol

String

authTypeNone

No

The authentication type. Valid values:

  • authTypeNone: No authentication type is specified.

  • authTypeSsl: SSL authentication is enabled.

truststoreFile

String

1

No

The ID of the truststore file.

truststorePassword

String

apasara

No

The password of the truststore file.

keystoreFile

String

2

No

The ID of the Keystore file.

keystorePassword

String

apasara

No

The password of the Keystore file.

driverVersion

String

8.2.0

No

The version of the driver. Valid values:

  • Left empty

  • 8.2.0

  • 5.1.49

  • 5.1.46

authType

String

PrimaryAccount

No

If you want to enable binary log reading from Object Storage Service (OSS), you must configure the authType parameter. Valid values:

  • PrimaryAccount

  • SubAccount

  • RamRole

authIdentity

String

123456

No

If you set the authType parameter to SubAccount, you must set the authIdentity parameter to the ID of a RAM user.

If you set the authType parameter to RamRole, you must set the authIdentity parameter to the ID of a RAM role.

You do not need to configure this parameter in the cross-account access scenario.

readOnlyDBInstance

String

rm-uf65l3bwae8w8r35

No

The ID of the secondary instance.

envType

String

Dev

Yes

The information about the data source environment. Valid values:

  • Dev: The development environment.

  • Prod: The production environment.

Cross-account instance mode

Parameter

Type

Example

Required

Description

regionId

String

cn-shanghai

Yes

The ID of the region to which the instance belongs.

instanceId

String

rm-xxxxxxxxx

Yes

The instance ID.

database

String

mysql_database

Yes

The name of the database.

username

String

xxxxx

Yes

The username.

password

String

xxxxx

Yes

The password.

crossAccountOwnerId

String

1

Yes

The ID of another Alibaba Cloud account.

crossAccountRoleName

String

mysql-role

Yes

The name of the RAM role assumed by another Alibaba Cloud account.

securityProtocol

String

authTypeNone

No

The authentication type. Valid values:

  • authTypeNone: No authentication type is specified.

  • authTypeSsl: SSL authentication is enabled.

truststoreFile

String

1

No

The ID of the truststore file.

truststorePassword

String

apasara

No

The password of the truststore file.

keystoreFile

String

2

No

The ID of the Keystore file.

keystorePassword

String

apasara

No

The password of the Keystore file.

driverVersion

String

8.2.0

No

The version of the driver. Valid values:

  • Left empty

  • 8.2.0

  • 5.1.49

  • 5.1.46

authType

String

PrimaryAccount

No

If you want to enable binary log reading from OSS, you must configure the authType parameter. Valid values:

  • RamRole

readOnlyDBInstance

String

rm-uf65l3bwae8w8r35

No

The ID of the secondary instance.

envType

String

Dev

Yes

The information about the data source environment. Valid values:

  • Dev: The development environment.

  • Prod: The production environment.

Connection string mode

Parameter

Type

Example

Required

Description

address

Array

[
  {
    "host": "127.0.0.1",
    "port": 3306
  }
]

Yes

The address, which can contain one or more pairs of host and port.

database

String

mysql_database

Yes

The name of the database.

username

String

xxxxx

Yes

The username.

password

String

xxxxx

Yes

The password.

securityProtocol

String

authTypeNone

No

The authentication type. Valid values:

  • authTypeNone: No authentication type is specified.

  • authTypeSsl: SSL authentication is enabled.

truststoreFile

String

1

No

The ID of the truststore file.

truststorePassword

String

apasara

No

The password of the truststore file.

keystoreFile

String

2

No

The ID of the Keystore file.

keystorePassword

String

apasara

No

The password of the Keystore file.

properties

JSON Object

{
    "useSSL": "false"
}

No

The properties of the driver.

envType

String

Dev

Yes

The information about the data source environment. Valid values:

  • Dev: The development environment.

  • Prod: The production environment.

Configuration examples

Current-account instance mode

{
    "instanceId": "rm-xxxxxxxxx",
    "regionId": "cn-shanghai",
    "database": "db",
    "username": "aliyun",
    "password": "xxx",
    "securityProtocol": "authTypeNone",
    "envType": "Dev"
}

Cross-account instance mode

{
    "instanceId": "rm-xxxxxxxxx",
    "regionId": "cn-shanghai",
    "database": "db",
    "username": "aliyun",
    "password": "xxx",
    "crossAccountOwnerId": "1234567890",
    "crossAccountRoleName": "my_ram_role",
    "securityProtocol": "authTypeNone",
    "envType": "Dev"
}

Connection string mode

{
    "address": [
        {
            "host": "127.0.0.1",
            "port": 5432
        }
    ],
    "database": "db",
    "properties": {
        "connectTimeout": "2000"
    },
    "username": "aliyun",
    "password": "xxx",
    "envType": "Dev"
}