Installation
Install the MySQL connector:Configuration
Configuration Parameters
Database hostname or IP address
Database port
Database name to connect to
Username for authentication
Password for authentication
Unix socket path (commonly required for Google Cloud SQL)
SSL configuration:
"true", "false", "Amazon RDS", or a JSON object with SSL optionsSSL/TLS Configuration
Basic SSL
connection.yaml
Amazon RDS SSL
connection.yaml
Custom SSL Options
Provide SSL options as a JSON string:connection.yaml
Features
Type Mapping
MySQL types are mapped to Evidence types:- Numbers: DECIMAL, TINYINT, SMALLINT, INT, BIGINT, FLOAT, DOUBLE
- Strings: VARCHAR, CHAR, TEXT, JSON
- Dates: TIMESTAMP, DATE, DATETIME, TIME, YEAR
MySQL does not have a native BOOLEAN type. TINYINT(1) is commonly used and mapped to numbers in Evidence.
Column Name Normalization
MySQL column names are automatically converted to lowercase for consistency.Decimal Precision
The connector preserves decimal precision by parsing DECIMAL and NUMERIC types as JavaScript numbers.Streaming Results
Queries stream results in batches (default 100,000 rows) for efficient memory usage with large datasets.Example Query
Create a SQL file in your Evidence project:queries/monthly_revenue.sql
Cloud Providers
Google Cloud SQL
When connecting to Google Cloud SQL, you may need to use Unix socket connections:connection.yaml
Amazon RDS
connection.yaml
Azure Database for MySQL
connection.yaml
Performance Tips
Use Indexes
Ensure commonly queried columns have indexes:Limit Result Sets
For large tables, always filter data:Optimize Joins
Troubleshooting
Connection refused
Connection refused
- Verify host and port are correct
- Check that MySQL is running
- Ensure firewall allows connections from your Evidence instance
- Verify the user has remote access privileges:
SSL connection errors
SSL connection errors
For cloud providers:
- Amazon RDS: Use
ssl: "Amazon RDS" - Google Cloud SQL: Use
ssl: "true"with socket connections - Azure: Use
ssl: "true"
Authentication plugin errors
Authentication plugin errors
If you see “ER_NOT_SUPPORTED_AUTH_MODE” or authentication plugin errors, you may need to update the user’s authentication method:
Google Cloud SQL socket errors
Google Cloud SQL socket errors
Ensure:
- The socket path format is correct:
/cloudsql/project:region:instance - The Cloud SQL Proxy is running (if connecting from outside Google Cloud)
- Your service account has the Cloud SQL Client role
Character encoding issues
Character encoding issues
Ensure your database uses UTF-8 encoding: