MySQL
Causely provides native integration with MySQL to help you identify and resolve database performance issues before they impact your users.
Instead of just monitoring symptoms, Causely analyzes real-time signals to surface the actual root causes of database problems.
This integration helps you identify common root causes, among others:
The integration supports both self-hosted MySQL instances and cloud-managed services including AWS RDS MySQL, Azure Database for MySQL, and Google Cloud SQL for MySQL.
Step 1: Create a user
Create a user for your MySQL database server with the following permissions:
PROCESS
: Required to view running queries and process informationREPLICATION CLIENT
: Required to monitor replication status and transaction informationSELECT
: Required to query performance metrics, table information, and schema detailsSHOW VIEW
: Required to access view definitions and metadata
Step 2: Enable performance monitoring features
Enable performance monitoring features in your MySQL instance to collect detailed metrics and query information. This step varies depending on your MySQL deployment type, as detailed below.
Native MySQL
For native MySQL installations, you need to enable the performance schema:
- Edit your MySQL configuration file (typically
/etc/mysql/my.cnf
or/etc/my.cnf
) - Add or update these settings:
[mysqld]
performance_schema=ON
AWS RDS MySQL
Steps:
- Go to RDS Console → Databases
- Select your MySQL instance
- Click "Modify"
- Under "Performance Insights", enable "Enable Performance Insights"
- Choose retention period (7 days or more)
- Click "Continue" and apply changes immediately
Azure Database for MySQL
Steps:
- Go to Azure Portal → Select your Azure Database for MySQL Flexible Server instance.
- On the left pane, under Settings, select Server parameters.
- For the slow_query_log parameter, select ON.
- For the other parameters, such as long_query_time and log_slow_admin_statements, refer to the slow query logs documentation.
- Click "Save"
Google Cloud SQL for MySQL
Steps:
- Go to Cloud Console → Cloud SQL
- Select your MySQL instance
- Click "Edit"
- Under "Query Insights", enable "Enable Query Insights"
- Choose retention period (7 days or more)
- Click "Save"
Step 3: Create a Kubernetes secret for the user
After creating the user create a Kubernetes secret:
kubectl create secret generic \
--namespace causely mysql-credentials \
--from-literal=db_instance="..." \
--from-literal=username="..." \
--from-literal=password='...' \
--from-literal=host="..." \
--from-literal=port=3306 \
--from-literal=database="..." \
--from-literal=sslmode="..."
The host
must be the FQDN of your DB, or IP address if there's no DNS entry set up.
It must match the FQDN/IP Causely would discover either from the K8s Server (if it's running in your K8s Cluster) or your Cloud providers API.
Examples:
- Kubernetes:
host=my-mysql.namespace.service.cluster.local
- AWS:
host=myinstance.rds.amazonaws.com
If you are leveraging a proxy to connect to your database, like it's common on GCP, host
must be the FQDN/IP of your proxy and additionally host_overwrite
should be the IP/FQDN of the actual database service:
- GCP:
host=localhost
(assuming proxy runs on the same host / Pod).host_overwrite=1.2.3.4
(the IP of your GCP Cloud SQL instance as shown in the GCP Console)
Step 4: Update Causely Configuration
Once the secret is created, update the Causely configuration to enable scraping for the new database. Below is an example configuration:
scrapers:
mysql:
enabled: true
instances:
- secretName: mysql-credentials
namespace: causely
Alternative: Enable Credentials Autodiscovery
Causely also supports credentials autodiscovery. This feature allows you to add new scraping targets without updating the Causely configuration. Label the Kubernetes secret to enable autodiscovery for the corresponding scraper.
kubectl --namespace causely label secret mysql-credentials "causely.ai/scraper=MySQL"