Manage MySQL catalog
After you configure a MySQL catalog, you can access the tables of a MySQL instance in the console of fully managed Flink. This topic describes how to configure, view, use, and delete a MySQL catalog in the console of fully managed Flink.
Background Information
When you use a MySQL catalog, take note of the following points:
- You can directly access a table of a MySQL instance without the need to execute DDL statements to register the MySQL table. This improves the efficiency and accuracy of data development.
- Tables of MySQL catalogs can be used as MySQL Change Data Capture (CDC) source tables, MySQL result tables, and MySQL dimension tables in Flink SQL jobs.
- Catalogs of self-managed MySQL databases are supported.
- Sharding-based logical tables can be directly accessed.
- You can use the CREATE DATABASE AS and CREATE TABLE AS statements to synchronize the full data of a database, the merged data of sharded tables in a sharded database, and changes in table schemas based on MySQL data sources.
Limits
-
You cannot modify the DDL statements that are related to catalogs.
-
You can only query data in databases. You cannot create databases.
-
If a table of a MySQL catalog is used as a MySQL CDC source table, you can read data from the source table only in streaming mode. If a table of a MySQL catalog is used as a dimension table or a result table, streaming processing is supported.
-
Only MySQL 5.7 and MySQL 8.0.X are supported.
-
When reading data from a table in the MySQL catalog, you can use the dynamic table option to disable SSL for that specific query. Here's an example of a query that does this:
-
SELECT * FROM `my-aws-mysql`.`vvc`.user_1
/*+ OPTIONS('jdbc.properties.useSSL' = 'false') */ -
By including the
OPTIONSclause with'jdbc.properties.useSSL' = 'false', you ensure that the query does not use SSL encryption when connecting to the MySQL database.
-
-
When writing data to a MySQL table in the MySQL catalog, you can override the connection URL by using the dynamic table option to disable TLS. Here's an example of how to do this using Flink SQL:
-
INSERT INTO `my-aws-mysql`.`vvc`.user_2
/*+ OPTIONS('url' = 'jdbc:mysql://your_hostname:3306/your_database_name?useSSL=false') */ -
Replace
your_hostnamewith the actual hostname of your MySQL server, andyour_database_namewith the name of the database you want to connect to. This query will write data fromsource_tableinto theuser_2table in the MySQL catalog with TLS disabled.
-
If a table of a MySQL catalog is used as a MySQL CDC source table, you must enable binary logging on the self-managed MySQL database.
Create a MySQL Catalog in the UI
-
On the Dashboard page, open the console for the workspace you want to manage.
-
In the Console navigation pane, click Catalogs.
-
On the Catalog list page, click Create Catalog.
-
In the Create Catalog dialog box, select MySQL and click Next.
-
Configure the parameters.
cautionAfter you create a MySQL catalog, the parameter configuration cannot be modified. If you want to modify the parameter configuration, you must delete the MySQL catalog that you created and create a MySQL catalog again.
Parameter Description Required name Catalog name. Yes hostname IP address or hostname of the MySQL database server. Please make sure that the network address can be connected to this product. Yes port The port to connect to the server. Yes default-database Name of the MySQL database to use when connecting to the MySQL database server. Yes username Name of the MySQL database to use when connecting to the MySQL database server. Yes password Password to use when connecting to the MySQL database server. Yes -
Click Confirm. You can see the created catalog on the catalogs list page in the Catalogs tab, as well as on the SQL Editor page (the right side Catalogs menu).