All Products
Search
Document Center

Dataphin:Create a TDSQL for MySQL data source

Last Updated:Jun 22, 2026

Create a TDSQL for MySQL data source so that Dataphin can read data from or write data to TDSQL for MySQL.

Permission requirements

Only super administrators, data source administrators, domain architects, project administrators, and custom global roles that have the Create Data Source permission can create data sources.

Procedure

  1. On the Dataphin home page, choose Management Center > Datasource Management from the top menu bar.

  2. On the Datasource page, click +Create Data Source.

  3. On the Create Data Source page, go to the Relational Database section and select TDSQL for MySQL.

    If you recently used TDSQL for MySQL, you can also select it from the Recently Used section, or enter keywords in the search box to find it quickly.

  4. On the Create TDSQL for MySQL Data Source page, configure the connection parameters for the data source.

    1. Configure the basic information for the data source.

      Parameter

      Description

      Datasource Name

      Enter a name for the data source. Follow these naming conventions:

      • The name can contain only Chinese characters, letters, digits, underscores (_), and hyphens (-).

      • The name can be up to 64 characters long.

      Datasource Code

      After you configure the data source code, you can directly access Dataphin data source tables in Flink_SQL tasks or using the Dataphin Java Database Connectivity (JDBC) client. Use the format datasource_code.table_name or datasource_code.schema.table_name for quick access. To automatically switch data sources based on the task execution environment, use the variable format ${datasource_code}.table or ${datasource_code}.schema.table. For more information, see Develop Dataphin data source tables.

      Important
      • The data source code cannot be modified after it is configured.

      • You can preview data on the object details page in the asset directory and asset checklist only after the data source code is configured.

      • In Flink SQL, only MySQL, Hologres, MaxCompute, Oracle, StarRocks, Hive, SelectDB, and GaussDB data warehouse service (DWS) data sources are currently supported.

      Data Source Description

      A brief description of the data source. The description can be up to 128 characters long.

      Data Source Configuration

      Specify whether to separate production and development data sources:

      • If your business data source separates production and development environments, select Production + Development Data Source.

      • If your business data source does not separate these environments, select Production Data Source.

      Tag

      Categorize data sources by using tags. For more information about creating tags, see Manage data source tags.

    2. Configure the connection parameters between the data source and Dataphin.

      If you set Data Source Configuration to Production + Development Data Source, configure the connection information for both. If you set it to Production Data Source, configure the connection information for the production data source only.

      Note

      To ensure environment isolation, use different data sources for production and development. This prevents the development data source from affecting the production data source. However, Dataphin also supports using the same data source for both environments if you configure them with identical parameter values.

      For Configuration Method, select JDBC URL or Host. The default is JDBC URL.

      JDBC URL configuration

      Parameter

      Description

      JDBC URL

      The format of the JDBC URL is jdbc:mysql://host:port/dbname.

      Note

      The default port for TDSQL for MySQL data sources is 3306.

      Username, Password

      The Username and Password for the database.

      Host configuration
      • Host configuration

        Parameter

        Description

        Server Address

        Enter the IP address and port number of the server.

        Click +Add to add multiple IP addresses and port numbers. Click the image icon to delete extra entries. You must keep at least one entry.

        dbname

        Enter the database name.

      • Parameter configuration

        Parameter

        Description

        Parameter

        • Parameter name: Select an existing parameter name or enter a custom one.

          Custom parameter names can contain only letters, digits, periods (.), underscores (_), and hyphens (-).

        • Parameter value: This is required if you select a parameter name. The value can contain only letters, digits, periods (.), underscores (_), and hyphens (-). The value can be up to 256 characters long.

        Note

        Click +Add Parameter to add multiple parameters. Click the image icon to delete extra parameters. You can add up to 30 parameters.

        Username, Password

        The username and password to log on to the TDSQL for MySQL instance.

      Note

      If you select Host as the configuration method and then switch to the JDBC URL method, the system combines the server IP address and port number to populate the JDBC URL.

    3. Configure advanced settings for the data source.

      Parameter

      Description

      connectTimeout

      The connection timeout period in milliseconds. Default: 900,000 ms (15 minutes).

      Note
      • If you specify `connectTimeout` in the JDBC URL, that value is used.

      • For data sources created before Dataphin V3.11, the default `connectTimeout` is -1, which means no timeout limit.

      socketTimeout

      The socket timeout period in milliseconds. Default: 1,800,000 ms (30 minutes).

      Note
      • If you specify `socketTimeout` in the JDBC URL, that value is used.

      • For data sources created before Dataphin V3.11, the default `socketTimeout` is -1, which means no timeout limit.

      Connection Retries

      The number of automatic retry attempts when a database connection times out. If the connection still fails after all retries, the connection attempt fails.

      Note
      • Default: 1 retry. Valid values: 0 to 10.

      • Connection retries apply by default to offline integration tasks and global quality checks. The asset quality module must be enabled for global quality checks. You can configure task-level retry counts separately in offline integration tasks.

    Note

    The following precedence rules apply to duplicate parameters across configuration methods:

    • If a parameter is defined in the JDBC URL, Advanced Settings, and Host Configuration, the value in the JDBC URL takes precedence.

    • If a parameter is defined in both the JDBC URL and Advanced Settings, the value in the JDBC URL takes precedence.

    • If a parameter is defined in both the Advanced Settings and Host Configuration, the value in the Advanced Settings takes precedence.

  5. Select a Default Resource Group. This resource group runs tasks related to the data source, such as database SQL tasks, offline full database migration, and data previews.

  6. Click Test Connection or click OK to save the configuration and create the TDSQL for MySQL data source.

    Clicking Test Connection tests the connectivity to Dataphin. Clicking OK directly saves the configuration and automatically tests the connection for all selected clusters. You can create the data source even if the connection test fails.

    Test Connection tests the connection for the Default Cluster or Registered Scheduling Clusters that have been registered in Dataphin and are in normal use. The Default Cluster is selected by default and cannot be deselected. If there are no resource groups under a Registered Scheduling Cluster, connection testing is not supported. You need to create a resource group first before testing the connection.

    • The selected clusters are only used to test network connectivity with the current data source and are not used for running related tasks later.

    • The test connection usually takes less than 2 minutes. If it times out, you can click the image icon to view the specific reason and retry.

    • Regardless of whether the test result is Connection Failed, Connection Successful, or Succeeded With Warning, the system will record the generation time of the final result.

      Note

      Only the test results for the Default Cluster include three connection statuses: Succeeded With Warning, Connection Successful, and Connection Failed. The test results for Registered Scheduling Clusters in Dataphin only include two connection statuses: Connection Successful and Connection Failed.

    • When the test result is Connection Failed, you can click the image icon to view the specific failure reason.

    • When the test result is Succeeded With Warning, it means that the application cluster connection is successful but the scheduling cluster connection failed. The current data source cannot be used for data development and integration. You can click the image icon to view the log information.