Create a MySQL data source to enable Dataphin to read data from or write data to MySQL.
Background information
MySQL is an open-source relational database management system widely used as a primary data storage system.
Permissions
Only custom global roles with the Create Data Source permission and the super administrator, data source administrator, domain architect, and project administrator roles can create data sources.
Procedure
-
On the Dataphin home page, go to Management Center > Datasource Management.
-
On the Datasource page, click +Create Data Source.
-
On the Create Data Source page, select MySQL in the Relational Database section.
You can also select MySQL from the Recently Used section or search for it.
-
On the Create MySQL Data Source page, configure the connection parameters.
-
Configure the basic information for the data source.
Parameter
Description
Datasource Name
Enter a data source name. Naming rules:
-
Supports Chinese characters, letters, digits, underscores (_), and hyphens (-).
-
Maximum length: 64 characters.
Datasource Code
The data source code enables direct table access in Flink SQL tasks or via the Dataphin JDBC client. Use
datasourcecode.tablenameordatasourcecode.schema.tablename. For environment-based switching, use${datasourcecode}.tableor${datasourcecode}.schema.table. Develop Dataphin data source tables.ImportantThe 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.
Version
Select a version: MySQL 5.1.43, MySQL 5.6/5.7, MySQL 8.0.x, MySQL 8.4.x, or RDS MySQL.
ImportantFor Alibaba Cloud MySQL instances, select RDS MySQL.
Data Source Description
Optional description. Maximum length: 128 characters.
Time Zone
Integration tasks process time-formatted data in this time zone. Default: Asia/Shanghai. Click Modify to change. Options:
-
GMT: GMT-12:00, GMT-11:00, GMT-10:00, GMT-09:30, GMT-09:00, GMT-08:00, GMT-07:00, GMT-06:00, GMT-05:00, GMT-04:00, GMT-03:00, GMT-03:00, GMT-02:30, GMT-02:00, GMT-01:00, GMT+00:00, GMT+01:00, GMT+02:00, GMT+03:00, GMT+03:30, GMT+04:00, GMT+04:30, GMT+05:00, GMT+05:30, GMT+05:45, GMT+06:00, GMT+06:30, GMT+07:00, GMT+08:00, GMT+08:45, GMT+09:00, GMT+09:30, GMT+10:00, GMT+10:30, GMT+11:00, GMT+12:00, GMT+12:45, GMT+13:00, GMT+14:00.
-
Daylight Saving Time: Africa/Cairo, America/Chicago, America/Denver, America/Los_Angeles, America/New_York, America/Sao_Paulo, Asia/Bangkok, Asia/Dubai, Asia/Kolkata, Asia/Shanghai, Asia/Tokyo, Atlantic/Azores, Australia/Sydney, Europe/Berlin, Europe/London, Europe/Moscow, Europe/Paris, Pacific/Auckland, Pacific/Honolulu.
Data Source Configuration
Select the environment configuration:
-
Production + Development Data Source: Separate environments for production and development.
-
Production Data Source: Single environment for both.
Tag
Add tags for categorization. Manage data source tags.
-
-
Configure the connection parameters between the data source and Dataphin.
The required connection parameters depend on the Data Source Configuration setting. Production + Development data source requires configuration for both environments. Production data source requires only the production connection.
NoteSeparate configurations isolate production from development. You can also use identical parameters for both environments.
Select a Configuration Method: JDBC URL (default), Host, .
JDBC URL configuration method
Parameter
Description
JDBC URL
The format of the JDBC URL is
jdbc:mysql://host:port/dbname.NoteThe default port for a MySQL data source is 3306.
Username, Password
The Username and Password for the database.
SSL Encryption
Upload a Truststore certificate and password when enabled.
Host configuration method
-
Host configuration
Parameter
Description
Server Address
Enter the server IP address and port.
Click +Add for multiple entries. Click the
icon to delete. At least one entry is required.dbname
Enter the database name.
-
Parameter configuration
Parameter
Description
Parameter
-
Parameter name: Select an existing parameter name or enter a custom parameter name.
A custom parameter name can contain only letters, digits, periods (.), underscores (_), and hyphens (-).
-
Parameter value: Required when a parameter name is selected. Supports letters, digits, periods (.), underscores (_), and hyphens (-). Maximum length: 256 characters.
NoteClick +Add Parameter to add more (maximum 30). Click the
icon to delete.Username, Password
The MySQL instance username and password.
SSL Encryption
Upload a Truststore certificate and password when enabled.
-
NoteSwitching from Host to JDBC URL auto-populates the JDBC URL from the configured server address and port.
-
-
Configure the advanced settings for the data source.
Parameter
Description
connectTimeout
Database connection timeout in milliseconds. Default: 900000 (15 minutes).
Note-
A `connectTimeout` value in the JDBC URL takes precedence.
-
For data sources created before Dataphin V3.11, the default is
-1(no timeout).
socketTimeout
Database socket timeout in milliseconds. Default: 1800000 (30 minutes).
Note-
A `socketTimeout` value in the JDBC URL takes precedence.
-
For data sources created before Dataphin V3.11, the default is
-1(no timeout).
Connection Retries
The system retries on connection timeout. The connection fails if all retries are exhausted.
Note-
Default: 1. Range: 0 to 10.
-
Applies to offline integration tasks and global quality checks by default. Global quality checks require the asset quality module. Offline integration tasks support task-level retry configuration.
-
NoteDuplicate parameter precedence:
-
JDBC URL takes precedence over Advanced Settings and Host configuration.
-
JDBC URL takes precedence over Advanced Settings.
-
Advanced Settings takes precedence over Host configuration.
-
-
Select a Default Resource Group for running data source tasks such as SQL tasks, offline migrations, and data previews.
-
Click Test Connection to verify connectivity, or click OK to save and create the data source.
Test Connection tests the current connection. OK tests all selected clusters and saves the data source regardless of test results.
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
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.
NoteOnly 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
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
icon to view the log information.