MySQL Database Connector
The MySQL connector enables comprehensive metadata management for MySQL databases (version 8.0.0 or greater). It provides automated discovery, data profiling, quality testing, and lineage tracking capabilities.Supported Features
- ✅ Metadata Discovery: Automatic schema, table, and column discovery
- ✅ Data Profiler: Statistical analysis and data profiling
- ✅ Data Quality: Custom quality tests and validations
- ✅ dbt Integration: dbt model and lineage support
- ✅ View Lineage: Table and view relationship tracking
- ✅ Column-level Lineage: Detailed column dependency mapping
- ✅ Query Usage: Query log analysis and usage statistics
- ✅ Sample Data: Data sampling for preview and analysis
- ✅ Auto-Classification: Automated data classification
- ✅ SSL Support: Secure connections with SSL/TLS
Limitations
- ❌ Owners: Owner information extraction not supported
- ❌ Tags: Tag metadata extraction not supported
- ❌ Stored Procedures: Stored procedure discovery not supported
Prerequisites
Database Requirements
- MySQL version 8.0.0 or greater
- User with access to
INFORMATION_SCHEMAtables - For lineage: Access to
mysql.general_logtable
User Permissions
Basic Metadata Access
Lineage and Usage Extraction
Requirements
Metadata
Note that We support MySQL (version 8.0.0 or greater) and the user should have access to theINFORMATION_SCHEMA table. By default a user can see only the rows in the INFORMATION_SCHEMA that correspond to objects for which the user has the proper access privileges.
Lineage & Usage
To extract lineage & usage you need to enable the query logging in mysql and the user used in the connection needs to have select access to themysql.general_log.
Log Table Management
Themysql.general_log table grows continuously as it stores query logs. This can consume significant storage space over time and affect the execution time of lineage and usage procedures.
- Note: We recommend cleaning up log tables only after successful execution of Usage & Lineage workflows to ensure no loss of query data during extraction. Once cleanup occurs, the query history is lost.
Create Manual Schedule to rotate logs
When you rotate log tables manually, the current log table is copied to a backup log table and the entries in the current log table are removed. If the backup log table already exists, then it is deleted before the current log table is copied to the backup. You can query the backup log table if needed. The backup log table for themysql.general_log table is named mysql.general_log_backup.
The backup log table for the mysql.slow_log table is named mysql.slow_log_backup
Create Automatic Event to clear older logs
You can also create automatic event like showed below which runs every week to clear older logs.mysql.general_log table manually by calling the mysql.rds_rotate_general_log procedure. You can rotate the mysql.slow_log table by calling the mysql.rds_rotate_slow_log procedure.
You can also check below docs about more info on logs & its rotation methods.
Best Practices:
- Monitor log table size regularly
- Implement a log rotation schedule
- Consider automating log cleanup after DAG execution
- Keep logging enabled only when needed for lineage extraction
Profiler & Data Quality
Executing the profiler workflow or data quality tests, will require the user to haveSELECT permission on the tables/schemas where the profiler/tests will be executed. More information on the profiler workflow setup can be found here and data quality tests here.
Metadata Ingestion
All connectors are defined as JSON Schemas. Here you can find the structure to create a connection to MySQL.1. Visit the Services Page
The first step is to ingest the metadata from your sources. Under Settings, you will find a Services link an external source system to Collate. Once a service is created, it can be used to configure metadata, usage, and profiler workflows. To visit the Services page, select Services from the Settings menu.2. Create a New Service
Click on the Add New Service button to start the Service creation.3. Select the Service Type
Select MySQL as the service type and click Next.4. Name and Describe your Service
Provide a name and description for your service as illustrated below.Connection Details
- Username: Specify the User to connect to MySQL. It should have enough privileges to read all the metadata.
- Auth Type: Basic Auth or IAM based auth to connect to instances / cloud rds.
-
Basic Auth:
- Password: Password to connect to MySQL.
-
IAM Based Auth:
- AWS Access Key ID & AWS Secret Access Key: When you interact with AWS, you specify your AWS security credentials to verify who you are and whether you have permission to access the resources that you are requesting. AWS uses the security credentials to authenticate and authorize your requests (docs).
AKIAIOSFODNN7EXAMPLE), and a secret access key (for example,wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY). You must use both the access key ID and secret access key together to authenticate your requests. You can find further information on how to manage your access keys here.- AWS Region: Each AWS Region is a separate geographic area in which AWS clusters data centers (docs).
- AWS Session Token (optional): If you are using temporary credentials to access your services, you will need to inform the AWS Access Key ID and AWS Secrets Access Key. Also, these will include an AWS Session Token.
- Endpoint URL (optional): To connect programmatically to an AWS service, you use an endpoint. An endpoint is the URL of the entry point for an AWS web service. The AWS SDKs and the AWS Command Line Interface (AWS CLI) automatically use the default endpoint for each service in an AWS Region. But you can specify an alternate endpoint for your API requests.
- Profile Name: A named profile is a collection of settings and credentials that you can apply to a AWS CLI command. When you specify a profile to run a command, the settings and credentials are used to run that command. Multiple named profiles can be stored in the config and credentials files.
default. Find here more information about Named profiles for the AWS CLI.- Assume Role Arn: Typically, you use
AssumeRolewithin your account or for cross-account access. In this field you’ll set theARN(Amazon Resource Name) of the policy of the other account.
AssumeRolefor theARNof the role in the other account. This is a required field if you’d like toAssumeRole. Find more information on AssumeRole.Assume Role Authentication Requirements
When using Assume Role authentication, ensure you provide the following details:- AWS Region: Specify the AWS region for your deployment.
- Assume Role Session Name: An identifier for the assumed role session. Use the role session name to uniquely identify a session when the same role is assumed by different principals or for different reasons.
CollateSession. Find more information about the Role Session Name.- Assume Role Source Identity: The source identity specified by the principal that is calling the
AssumeRoleoperation. You can use source identity information in AWS CloudTrail logs to determine who took actions with a role.
-
Basic Auth:
- Host and Port: Enter the fully qualified hostname and port number for your MySQL deployment in the Host and Port field.
- databaseName: Optional name to give to the database in Collate. If left blank, we will use default as the database name.
- databaseSchema: databaseSchema of the data source. This is optional parameter, if you would like to restrict the metadata reading to a single databaseSchema. When left blank, Collate Ingestion attempts to scan all the databaseSchema.
- caCertificate: Provide the path to ssl ca file.
- sslCertificate: Provide the path to ssl client certificate file (ssl_cert).
- sslKey: Provide the path to ssl client certificate file (ssl_key).
Securing MySQL Connection with SSL in Collate
To establish secure connections between Collate and MySQL, navigate to theAdvanced Config section. Here, you can provide the CA certificate used for SSL validation by specifying the caCertificate. Alternatively, if both client and server require mutual authentication, you’ll need to use all three parameters: ssl_key, ssl_cert, and ssl_ca. In this case, ssl_cert is used for the client’s SSL certificate, ssl_key for the private key associated with the SSL certificate, and ssl_ca for the CA certificate to validate the server’s certificate.