---
title: MySQL
description: >-
  Collect performance schema metrics, query throughput, custom metrics, and
  more.
breadcrumbs: Docs > Integrations > MySQL
---

# MySQL
Supported OS Integration version15.16.1
{% callout %}
# Important note for users on the following Datadog sites: us2.ddog-gov.com

{% alert level="info" %}
To find out if this integration is available in your organization, see your [Datadog Integrations](https://app.datadoghq.com/integrations) page or ask your organization administrator.

To initiate an exception request to enable this integration for your organization, email [support@ddog-gov.com](mailto:support@ddog-gov.com).
{% /alert %}

{% /callout %}



## Overview{% #overview %}

The MySQL integration tracks the performance of your MySQL instances. It collects metrics related to throughput, connections, errors, and InnoDB metrics.

Enable [Database Monitoring](https://docs.datadoghq.com/database_monitoring/setup_mysql.md) (DBM) for enhanced insights into query performance and database health. In addition to the standard integration, Datadog DBM provides query-level metrics, live and historical query snapshots, wait event analysis, database load, and query explain plans.

Supported versions:

| Distribution | Versions                |
| ------------ | ----------------------- |
| MySQL        | 5.6, 5.7, 8.0, 8.4      |
| MariaDB      | 10.5, 10.6, 10.11, 11.4 |
| Percona      | 8.0, 8.4                |

**Minimum Agent version:** 6.0.0

## Setup{% #setup %}

{% alert level="info" %}
This page describes the MySQL Agent standard integration. If you are looking for the Database Monitoring product for MySQL, see Datadog Database Monitoring.
{% /alert %}

### Installation{% #installation %}

The MySQL check is included in the [Datadog Agent](https://app.datadoghq.com/account/settings/agent/latest) package. No additional installation is needed on your MySQL server.

#### Prepare MySQL{% #prepare-mysql %}

**Note**: To install Database Monitoring for MySQL, select your hosting solution in the [Database Monitoring documentation](https://docs.datadoghq.com/database_monitoring.md#mysql) for instructions.

Proceed with the following steps in this guide only if you are installing the standard integration alone.

On each MySQL server, create a database user for the Datadog Agent.

The following instructions grant the Agent permission to login from any host using `datadog@'%'`. You can restrict the `datadog` user to be allowed to login only from localhost by using `datadog@'localhost'`. See [MySQL Adding Accounts, Assigning Privileges, and Dropping Accounts](https://dev.mysql.com/doc/refman/8.0/en/creating-accounts.html) for more info.

Create the `datadog` user with the following command:

```shell
mysql> CREATE USER 'datadog'@'%' IDENTIFIED BY '<UNIQUEPASSWORD>';
Query OK, 0 rows affected (0.00 sec)
```

Verify the user was created successfully using the following commands - replace `<UNIQUEPASSWORD>` with the password you created above:

```shell
mysql -u datadog --password=<UNIQUEPASSWORD> -e "show status" | \
grep Uptime && echo -e "\033[0;32mMySQL user - OK\033[0m" || \
echo -e "\033[0;31mCannot connect to MySQL\033[0m"
```

The Agent needs a few privileges to collect metrics. Grant the `datadog` user only the following limited privileges.

For MySQL versions 5.6 and 5.7, grant `replication client` and set `max_user_connections` with the following command:

```shell
mysql> GRANT REPLICATION CLIENT ON *.* TO 'datadog'@'%' WITH MAX_USER_CONNECTIONS 5;
Query OK, 0 rows affected, 1 warning (0.00 sec)
```

For MySQL 8.0 or greater, grant `replication client` and set `max_user_connections` with the following commands:

```shell
mysql> GRANT REPLICATION CLIENT ON *.* TO 'datadog'@'%';
Query OK, 0 rows affected (0.00 sec)
mysql> ALTER USER 'datadog'@'%' WITH MAX_USER_CONNECTIONS 5;
Query OK, 0 rows affected (0.00 sec)
```

Grant the `datadog` user the process privilege:

```shell
mysql> GRANT PROCESS ON *.* TO 'datadog'@'%';
Query OK, 0 rows affected (0.00 sec)
```

Verify the replication client. Replace `<UNIQUEPASSWORD>` with the password you created above:

```shell
mysql -u datadog --password=<UNIQUEPASSWORD> -e "show slave status" && \
echo -e "\033[0;32mMySQL grant - OK\033[0m" || \
echo -e "\033[0;31mMissing REPLICATION CLIENT grant\033[0m"
```

If enabled, metrics can be collected from the `performance_schema` database by granting an additional privilege:

```shell
mysql> show databases like 'performance_schema';
+-------------------------------+
| Database (performance_schema) |
+-------------------------------+
| performance_schema            |
+-------------------------------+
1 row in set (0.00 sec)

mysql> GRANT SELECT ON performance_schema.* TO 'datadog'@'%';
Query OK, 0 rows affected (0.00 sec)
```

To collect index metrics, grant the `datadog` user an additional privilege:

```shell

mysql> GRANT SELECT ON mysql.innodb_index_stats TO 'datadog'@'%';
Query OK, 0 rows affected (0.00 sec)
```

### Configuration{% #configuration %}

**Note**: For a full list of available configuration options, see the [sample mysql.d/conf.yaml](https://github.com/DataDog/integrations-core/blob/master/mysql/datadog_checks/mysql/data/conf.yaml.example).

{% tab title="Host" %}
#### Host{% #host %}

To configure this check for an Agent running on a host:

##### Metric collection{% #metric-collection %}

- Add this configuration block to your `mysql.d/conf.yaml` to collect your MySQL metrics:

  ```yaml
  init_config:
  
  instances:
    - host: 127.0.0.1
      username: datadog
      password: "<YOUR_CHOSEN_PASSWORD>" # from the CREATE USER step earlier
      port: "<YOUR_MYSQL_PORT>" # e.g. 3306
      options:
        replication: false
        galera_cluster: true
        extra_status_metrics: true
        extra_innodb_metrics: true
        schema_size_metrics: false
        disable_innodb_metrics: false
  ```

**Note**: Wrap your password in single quotes in case a special character is present.

To collect `extra_performance_metrics`, your MySQL server must have `performance_schema` enabled - otherwise set `extra_performance_metrics` to `false`. For more information on `performance_schema`, see [MySQL Performance Schema Quick Start](https://dev.mysql.com/doc/refman/8.4/en/performance-schema-quick-start.html).

**Note**: The `datadog` user should be set up in the MySQL integration configuration as `host: 127.0.0.1` instead of `localhost`. Alternatively, you may also use `sock`.

[Restart the Agent](https://docs.datadoghq.com/agent/guide/agent-commands.md#start-stop-and-restart-the-agent) to start sending MySQL metrics to Datadog.

##### Log collection{% #log-collection %}

*Available for Agent versions >6.0*

1. By default MySQL logs everything in `/var/log/syslog` which requires root access to read. To make the logs more accessible, follow these steps:

   - Edit `/etc/mysql/conf.d/mysqld_safe_syslog.cnf` and remove or comment the lines.

   - Edit `/etc/mysql/my.cnf` and add following lines to enable general, error, and slow query logs:

     ```gdscript3
       [mysqld_safe]
       log_error = /var/log/mysql/mysql_error.log
     
       [mysqld]
       general_log = on
       general_log_file = /var/log/mysql/mysql.log
       log_error = /var/log/mysql/mysql_error.log
       slow_query_log = on
       slow_query_log_file = /var/log/mysql/mysql_slow.log
       long_query_time = 2
     ```

   - Save the file and restart MySQL using following commands: `service mysql restart`

   - Make sure the Agent has read access on the `/var/log/mysql` directory and all of the files within. Double-check your logrotate configuration to make sure those files are taken into account and that the permissions are correctly set there as well.

   - In `/etc/logrotate.d/mysql-server` there should be something similar to:

     ```text
       /var/log/mysql.log /var/log/mysql/mysql.log /var/log/mysql/mysql_slow.log {
               daily
               rotate 7
               missingok
               create 644 mysql adm
               Compress
       }
     ```

1. Collecting logs is disabled by default in the Datadog Agent, enable it in your `datadog.yaml` file:

   ```yaml
   logs_enabled: true
   ```

1. Add this configuration block to your `mysql.d/conf.yaml` file to start collecting your MySQL logs:

   ```yaml
   logs:
     - type: file
       path: "<ERROR_LOG_FILE_PATH>"
       source: mysql
       service: "<SERVICE_NAME>"
   
     - type: file
       path: "<SLOW_QUERY_LOG_FILE_PATH>"
       source: mysql
       service: "<SERVICE_NAME>"
       log_processing_rules:
         - type: multi_line
           name: new_slow_query_log_entry
           pattern: "# Time:"
           # If mysqld was started with `--log-short-format`, use:
           # pattern: "# Query_time:"
           # If using mysql version <5.7, use the following rules instead:
           # - type: multi_line
           #   name: new_slow_query_log_entry
           #   pattern: "# Time|# User@Host"
           # - type: exclude_at_match
           #   name: exclude_timestamp_only_line
           #   pattern: "# Time:"
   
     - type: file
       path: "<GENERAL_LOG_FILE_PATH>"
       source: mysql
       service: "<SERVICE_NAME>"
       # For multiline logs, if they start by the date with the format yyyy-mm-dd uncomment the following processing rule
       # log_processing_rules:
       #   - type: multi_line
       #     name: new_log_start_with_date
       #     pattern: \d{4}\-(0?[1-9]|1[012])\-(0?[1-9]|[12][0-9]|3[01])
       # If the logs start with a date with the format yymmdd but include a timestamp with each new second, rather than with each log, uncomment the following processing rule
       # log_processing_rules:
       #   - type: multi_line
       #     name: new_logs_do_not_always_start_with_timestamp
       #     pattern: \t\t\s*\d+\s+|\d{6}\s+\d{,2}:\d{2}:\d{2}\t\s*\d+\s+
   ```

See the [sample mysql.yaml](https://github.com/DataDog/integrations-core/blob/master/mysql/datadog_checks/mysql/data/conf.yaml.example) for all available configuration options, including those for custom metrics.

1. [Restart the Agent](https://docs.datadoghq.com/agent/guide/agent-commands.md#start-stop-and-restart-the-agent).

{% /tab %}

{% tab title="Docker" %}
#### Docker{% #docker %}

To configure this check for an Agent running on a container:

##### Metric collection{% #metric-collection %}

Set [Autodiscovery Integration Templates](https://docs.datadoghq.com/agent/docker/integrations.md?tab=docker) as Docker labels on your application container:

```yaml
LABEL "com.datadoghq.ad.check_names"='["mysql"]'
LABEL "com.datadoghq.ad.init_configs"='[{}]'
LABEL "com.datadoghq.ad.instances"='[{"server": "%%host%%", "username": "datadog","password": "<UNIQUEPASSWORD>"}]'
```

See [Autodiscovery template variables](https://docs.datadoghq.com/agent/faq/template_variables.md) for details on using `<UNIQUEPASSWORD>` as an environment variable instead of a label.

#### Log collection{% #log-collection %}

Collecting logs is disabled by default in the Datadog Agent. To enable it, see [Docker Log Collection](https://docs.datadoghq.com/agent/docker/log.md?tab=containerinstallation#installation).

Then, set [Log Integrations](https://docs.datadoghq.com/agent/docker/log.md?tab=containerinstallation#log-integrations) as Docker labels:

```yaml
LABEL "com.datadoghq.ad.logs"='[{"source":"mysql","service":"mysql"}]'
```

{% /tab %}

{% tab title="Kubernetes" %}
#### Kubernetes{% #kubernetes %}

To configure this check for an Agent running on Kubernetes:

##### Metric collection{% #metric-collection %}

Set [Autodiscovery Integrations Templates](https://docs.datadoghq.com/agent/kubernetes/integrations.md?tab=kubernetes) as pod annotations on your application container. Alternatively, you can configure templates with a [file, configmap, or key-value store](https://docs.datadoghq.com/agent/kubernetes/integrations.md?tab=kubernetes#configuration).

**Annotations v1** (for Datadog Agent < v7.36)

```yaml
apiVersion: v1
kind: Pod
metadata:
  name: mysql
  annotations:
    ad.datadoghq.com/mysql.check_names: '["mysql"]'
    ad.datadoghq.com/mysql.init_configs: '[{}]'
    ad.datadoghq.com/mysql.instances: |
      [
        {
          "server": "%%host%%",
          "username": "datadog",
          "password": "<UNIQUEPASSWORD>"
        }
      ]
  labels:
    name: mysql
spec:
  containers:
    - name: mysql
```

**Annotations v2** (for Datadog Agent v7.36+)

```yaml
apiVersion: v1
kind: Pod
metadata:
  name: mysql
  annotations:
    ad.datadoghq.com/mysql.checks: |
      {
        "mysql": {
          "instances": [
            {
              "server": "%%host%%",
              "username": "datadog",
              "password": "<UNIQUEPASSWORD>"
            }
          ]
        }
      }
  labels:
    name: mysql
spec:
  containers:
    - name: mysql
```

See [Autodiscovery template variables](https://docs.datadoghq.com/agent/faq/template_variables.md) for details on using `<UNIQUEPASSWORD>` as an environment variable instead of a label.

#### Log collection{% #log-collection %}

Collecting logs is disabled by default in the Datadog Agent. To enable it, see [Kubernetes Log Collection](https://docs.datadoghq.com/agent/kubernetes/log.md?tab=containerinstallation#setup).

Then, set [Log Integrations](https://docs.datadoghq.com/agent/docker/log.md?tab=containerinstallation#log-integrations) as pod annotations. Alternatively, you can configure this with a [file, configmap, or key-value store](https://docs.datadoghq.com/agent/kubernetes/log.md?tab=daemonset#configuration).

**Annotations v1/v2**

```yaml
apiVersion: v1
kind: Pod
metadata:
  name: mysql
  annotations:
    ad.datadoghq.com/mysql.logs: '[{"source": "mysql", "service": "mysql"}]'
  labels:
    name: mysql
```

{% /tab %}

{% tab title="ECS" %}
#### ECS{% #ecs %}

To configure this check for an Agent running on ECS:

##### Metric collection{% #metric-collection %}

Set [Autodiscovery Integrations Templates](https://docs.datadoghq.com/agent/docker/integrations.md?tab=docker) as Docker labels on your application container:

```json
{
  "containerDefinitions": [{
    "name": "mysql",
    "image": "mysql:latest",
    "dockerLabels": {
      "com.datadoghq.ad.check_names": "[\"mysql\"]",
      "com.datadoghq.ad.init_configs": "[{}]",
      "com.datadoghq.ad.instances": "[{\"server\": \"%%host%%\", \"username\": \"datadog\",\"password\": \"<UNIQUEPASSWORD>\"}]"
    }
  }]
}
```

See [Autodiscovery template variables](https://docs.datadoghq.com/agent/faq/template_variables.md) for details on using `<UNIQUEPASSWORD>` as an environment variable instead of a label.

##### Log collection{% #log-collection %}

*Available for Agent versions >6.0*

Collecting logs is disabled by default in the Datadog Agent. To enable it, see [ECS Log Collection](https://docs.datadoghq.com/agent/amazon_ecs/logs.md?tab=linux).

Then, set [Log Integrations](https://docs.datadoghq.com/agent/docker/log.md?tab=containerinstallation#log-integrations) as Docker labels:

```yaml
{
  "containerDefinitions": [{
    "name": "mysql",
    "image": "mysql:latest",
    "dockerLabels": {
      "com.datadoghq.ad.logs": "[{\"source\":\"mysql\",\"service\":\"mysql\"}]"
    }
  }]
}
```

{% /tab %}

### Validation{% #validation %}

[Run the Agent's status subcommand](https://docs.datadoghq.com/agent/guide/agent-commands.md#agent-status-and-information) and look for `mysql` under the Checks section.

## Data Collected{% #data-collected %}

### Metrics{% #metrics %}

|  |
|  |
| **mysql.binlog.cache\_disk\_use**(gauge)                            | The number of transactions that used the temporary binary log cache but that exceeded the value of `binlog_cache_size` and used a temporary file to store statements from the transaction.*Shown as transaction*                                          |
| **mysql.binlog.cache\_use**(gauge)                                  | The number of transactions that used the binary log cache.*Shown as transaction*                                                                                                                                                                          |
| **mysql.binlog.disk\_use**(gauge)                                   | Total binary log file size.*Shown as byte*                                                                                                                                                                                                                |
| **mysql.galera.wsrep\_cert\_deps\_distance**(gauge)                 | Shows the average distance between the lowest and highest sequence number, or seqno, values that the node can possibly apply in parallel.                                                                                                                 |
| **mysql.galera.wsrep\_cluster\_size**(gauge)                        | The current number of nodes in the Galera cluster.*Shown as node*                                                                                                                                                                                         |
| **mysql.galera.wsrep\_flow\_control\_paused**(gauge)                | Shows the fraction of the time, since FLUSH STATUS was last called, that the node paused due to Flow Control.*Shown as fraction*                                                                                                                          |
| **mysql.galera.wsrep\_flow\_control\_paused\_ns**(count)            | Shows the pause time due to Flow Control, in nanoseconds.*Shown as nanosecond*                                                                                                                                                                            |
| **mysql.galera.wsrep\_flow\_control\_recv**(count)                  | Shows the number of times the galera node has received a pausing Flow Control message from others                                                                                                                                                         |
| **mysql.galera.wsrep\_flow\_control\_sent**(count)                  | Shows the number of times the galera node has sent a pausing Flow Control message to others                                                                                                                                                               |
| **mysql.galera.wsrep\_local\_cert\_failures**(count)                | Total number of local transactions that failed certification test.                                                                                                                                                                                        |
| **mysql.galera.wsrep\_local\_recv\_queue**(gauge)                   | Shows the current (instantaneous) size of the local received queue.                                                                                                                                                                                       |
| **mysql.galera.wsrep\_local\_recv\_queue\_avg**(gauge)              | Shows the average size of the local received queue since the last FLUSH STATUS query.                                                                                                                                                                     |
| **mysql.galera.wsrep\_local\_send\_queue**(gauge)                   | Show the current (instantaneous) size of the send queue length since the last FLUSH STATUS query.                                                                                                                                                         |
| **mysql.galera.wsrep\_local\_send\_queue\_avg**(gauge)              | Show an average for the send queue length since the last FLUSH STATUS query.                                                                                                                                                                              |
| **mysql.galera.wsrep\_local\_state**(gauge)                         | Internal Galera cluster state number                                                                                                                                                                                                                      |
| **mysql.galera.wsrep\_received**(gauge)                             | Total number of write-sets received from other nodes.                                                                                                                                                                                                     |
| **mysql.galera.wsrep\_received\_bytes**(gauge)                      | Total size (in bytes) of writesets received from other nodes.                                                                                                                                                                                             |
| **mysql.galera.wsrep\_replicated\_bytes**(gauge)                    | Total size (in bytes) of writesets sent to other nodes.                                                                                                                                                                                                   |
| **mysql.index.deletes**(gauge)                                      | The number of delete operations using an index. Resets to 0 upon database restart.*Shown as operation*                                                                                                                                                    |
| **mysql.index.reads**(gauge)                                        | The number of read operations using an index. Resets to 0 upon database restart.*Shown as operation*                                                                                                                                                      |
| **mysql.index.size**(gauge)                                         | Size of index in bytes*Shown as byte*                                                                                                                                                                                                                     |
| **mysql.index.updates**(gauge)                                      | The number of update operations using an index. Resets to 0 upon database restart.*Shown as operation*                                                                                                                                                    |
| **mysql.info.schema.size**(gauge)                                   | Size of schemas in MiB*Shown as mebibyte*                                                                                                                                                                                                                 |
| **mysql.info.table.data\_size**(gauge)                              | Size of tables data in MiB*Shown as mebibyte*                                                                                                                                                                                                             |
| **mysql.info.table.index\_size**(gauge)                             | Size of tables index in MiB*Shown as mebibyte*                                                                                                                                                                                                            |
| **mysql.info.table.rows.changed**(count)                            | Total number of rows changed per table (Percona userstat only)*Shown as row*                                                                                                                                                                              |
| **mysql.info.table.rows.read**(count)                               | Total number of rows read per table (Percona userstat only)*Shown as row*                                                                                                                                                                                 |
| **mysql.innodb.active\_transactions**(gauge)                        | The number of active transactions on InnoDB tables.*Shown as operation*                                                                                                                                                                                   |
| **mysql.innodb.buffer\_pool\_data**(gauge)                          | The total number of bytes in the InnoDB buffer pool containing data. The number includes both dirty and clean pages.*Shown as byte*                                                                                                                       |
| **mysql.innodb.buffer\_pool\_dirty**(gauge)                         | The total current number of bytes held in dirty pages in the InnoDB buffer pool.*Shown as byte*                                                                                                                                                           |
| **mysql.innodb.buffer\_pool\_free**(gauge)                          | The number of free bytes in the InnoDB Buffer Pool.*Shown as byte*                                                                                                                                                                                        |
| **mysql.innodb.buffer\_pool\_pages\_data**(gauge)                   | The number of pages in the InnoDB buffer pool containing data. The number includes both dirty and clean pages.*Shown as page*                                                                                                                             |
| **mysql.innodb.buffer\_pool\_pages\_dirty**(gauge)                  | The current number of dirty pages in the InnoDB buffer pool.*Shown as page*                                                                                                                                                                               |
| **mysql.innodb.buffer\_pool\_pages\_flushed**(gauge)                | The number of requests to flush pages from the InnoDB buffer pool.*Shown as page*                                                                                                                                                                         |
| **mysql.innodb.buffer\_pool\_pages\_free**(gauge)                   | The number of free pages in the InnoDB buffer pool.*Shown as page*                                                                                                                                                                                        |
| **mysql.innodb.buffer\_pool\_pages\_total**(gauge)                  | The total size of the InnoDB buffer pool, in pages.*Shown as page*                                                                                                                                                                                        |
| **mysql.innodb.buffer\_pool\_read\_ahead**(gauge)                   | The number of pages read into the InnoDB buffer pool by the read-ahead background thread.*Shown as page*                                                                                                                                                  |
| **mysql.innodb.buffer\_pool\_read\_ahead\_evicted**(gauge)          | The number of pages read into the InnoDB buffer pool by the read-ahead background thread that were subsequently evicted without having been accessed by queries.*Shown as page*                                                                           |
| **mysql.innodb.buffer\_pool\_read\_ahead\_rnd**(gauge)              | The number of random read-aheads initiated by InnoDB. This happens when a query scans a large portion of a table but in random order.*Shown as operation*                                                                                                 |
| **mysql.innodb.buffer\_pool\_read\_requests**(gauge)                | The number of logical read requests.*Shown as read*                                                                                                                                                                                                       |
| **mysql.innodb.buffer\_pool\_reads**(gauge)                         | The number of logical reads that InnoDB could not satisfy from the buffer pool, and had to read directly from disk.*Shown as read*                                                                                                                        |
| **mysql.innodb.buffer\_pool\_total**(gauge)                         | The total number of bytes in the InnoDB Buffer Pool.*Shown as byte*                                                                                                                                                                                       |
| **mysql.innodb.buffer\_pool\_used**(gauge)                          | The number of used bytes in the InnoDB Buffer Pool.*Shown as byte*                                                                                                                                                                                        |
| **mysql.innodb.buffer\_pool\_utilization**(gauge)                   | The utilization of the InnoDB Buffer Pool.*Shown as fraction*                                                                                                                                                                                             |
| **mysql.innodb.buffer\_pool\_wait\_free**(count)                    | When InnoDB needs to read or create a page and no clean pages are available, InnoDB flushes some dirty pages first and waits for that operation to finish. This counter counts instances of these waits.*Shown as wait*                                   |
| **mysql.innodb.buffer\_pool\_write\_requests**(gauge)               | The number of writes done to the InnoDB buffer pool.*Shown as write*                                                                                                                                                                                      |
| **mysql.innodb.checkpoint\_age**(gauge)                             | Checkpoint age as shown in the LOG section of the SHOW ENGINE INNODB STATUS output.                                                                                                                                                                       |
| **mysql.innodb.current\_row\_locks**(gauge)                         | The number of current row locks.*Shown as lock*                                                                                                                                                                                                           |
| **mysql.innodb.current\_transactions**(gauge)                       | Current InnoDB transactions*Shown as transaction*                                                                                                                                                                                                         |
| **mysql.innodb.data\_fsyncs**(gauge)                                | The number of fsync() operations per second.*Shown as operation*                                                                                                                                                                                          |
| **mysql.innodb.data\_pending\_fsyncs**(gauge)                       | The current number of pending fsync() operations.*Shown as operation*                                                                                                                                                                                     |
| **mysql.innodb.data\_pending\_reads**(gauge)                        | The current number of pending reads.*Shown as read*                                                                                                                                                                                                       |
| **mysql.innodb.data\_pending\_writes**(gauge)                       | The current number of pending writes.*Shown as write*                                                                                                                                                                                                     |
| **mysql.innodb.data\_read**(gauge)                                  | The amount of data read per second.*Shown as byte*                                                                                                                                                                                                        |
| **mysql.innodb.data\_reads**(gauge)                                 | The rate of data reads.*Shown as read*                                                                                                                                                                                                                    |
| **mysql.innodb.data\_writes**(gauge)                                | The rate of data writes.*Shown as write*                                                                                                                                                                                                                  |
| **mysql.innodb.data\_written**(gauge)                               | The amount of data written per second.*Shown as byte*                                                                                                                                                                                                     |
| **mysql.innodb.dblwr\_pages\_written**(gauge)                       | The number of pages written per second to the doublewrite buffer.*Shown as page*                                                                                                                                                                          |
| **mysql.innodb.dblwr\_writes**(gauge)                               | The number of doublewrite operations performed per second.*Shown as byte*                                                                                                                                                                                 |
| **mysql.innodb.deadlocks**(count)                                   | The number of deadlocks.*Shown as lock*                                                                                                                                                                                                                   |
| **mysql.innodb.hash\_index\_cells\_total**(gauge)                   | Total number of cells of the adaptive hash index                                                                                                                                                                                                          |
| **mysql.innodb.hash\_index\_cells\_used**(gauge)                    | Number of used cells of the adaptive hash index                                                                                                                                                                                                           |
| **mysql.innodb.history\_list\_length**(gauge)                       | History list length as shown in the TRANSACTIONS section of the SHOW ENGINE INNODB STATUS output.                                                                                                                                                         |
| **mysql.innodb.ibuf\_free\_list**(gauge)                            | Insert buffer free list, as shown in the INSERT BUFFER AND ADAPTIVE HASH INDEX section of the SHOW ENGINE INNODB STATUS output.                                                                                                                           |
| **mysql.innodb.ibuf\_merged**(gauge)                                | Insert buffer and adaptative hash index merged*Shown as operation*                                                                                                                                                                                        |
| **mysql.innodb.ibuf\_merged\_delete\_marks**(gauge)                 | Insert buffer and adaptative hash index merged delete marks*Shown as operation*                                                                                                                                                                           |
| **mysql.innodb.ibuf\_merged\_deletes**(gauge)                       | Insert buffer and adaptative hash index merged delete*Shown as operation*                                                                                                                                                                                 |
| **mysql.innodb.ibuf\_merged\_inserts**(gauge)                       | Insert buffer and adaptative hash index merged inserts*Shown as operation*                                                                                                                                                                                |
| **mysql.innodb.ibuf\_merges**(gauge)                                | Insert buffer and adaptative hash index merges*Shown as operation*                                                                                                                                                                                        |
| **mysql.innodb.ibuf\_segment\_size**(gauge)                         | Insert buffer segment size, as shown in the INSERT BUFFER AND ADAPTIVE HASH INDEX section of the SHOW ENGINE INNODB STATUS output.                                                                                                                        |
| **mysql.innodb.ibuf\_size**(gauge)                                  | Insert buffer size, as shown in the INSERT BUFFER AND ADAPTIVE HASH INDEX section of the SHOW ENGINE INNODB STATUS output.                                                                                                                                |
| **mysql.innodb.lock\_structs**(gauge)                               | Lock structs*Shown as operation*                                                                                                                                                                                                                          |
| **mysql.innodb.locked\_tables**(gauge)                              | Locked tables*Shown as operation*                                                                                                                                                                                                                         |
| **mysql.innodb.log\_waits**(gauge)                                  | The number of times that the log buffer was too small and a wait was required for it to be flushed before continuing.*Shown as wait*                                                                                                                      |
| **mysql.innodb.log\_write\_requests**(gauge)                        | The number of write requests for the InnoDB redo log.*Shown as write*                                                                                                                                                                                     |
| **mysql.innodb.log\_writes**(gauge)                                 | The number of physical writes to the InnoDB redo log file.*Shown as write*                                                                                                                                                                                |
| **mysql.innodb.lsn\_current**(gauge)                                | Log sequence number as shown in the LOG section of the SHOW ENGINE INNODB STATUS output.                                                                                                                                                                  |
| **mysql.innodb.lsn\_flushed**(gauge)                                | Flushed up to log sequence number as shown in the LOG section of the SHOW ENGINE INNODB STATUS output.                                                                                                                                                    |
| **mysql.innodb.lsn\_last\_checkpoint**(gauge)                       | Log sequence number last checkpoint as shown in the LOG section of the SHOW ENGINE INNODB STATUS output.                                                                                                                                                  |
| **mysql.innodb.mem\_adaptive\_hash**(gauge)                         | As shown in the BUFFER POOL AND MEMORY section of the SHOW ENGINE INNODB STATUS output.*Shown as byte*                                                                                                                                                    |
| **mysql.innodb.mem\_additional\_pool**(gauge)                       | As shown in the BUFFER POOL AND MEMORY section of the SHOW ENGINE INNODB STATUS output. Only available in MySQL 5.6.*Shown as byte*                                                                                                                       |
| **mysql.innodb.mem\_dictionary**(gauge)                             | As shown in the BUFFER POOL AND MEMORY section of the SHOW ENGINE INNODB STATUS output.*Shown as byte*                                                                                                                                                    |
| **mysql.innodb.mem\_file\_system**(gauge)                           | As shown in the BUFFER POOL AND MEMORY section of the SHOW ENGINE INNODB STATUS output.                                                                                                                                                                   |
| **mysql.innodb.mem\_lock\_system**(gauge)                           | As shown in the BUFFER POOL AND MEMORY section of the SHOW ENGINE INNODB STATUS output.                                                                                                                                                                   |
| **mysql.innodb.mem\_page\_hash**(gauge)                             | As shown in the BUFFER POOL AND MEMORY section of the SHOW ENGINE INNODB STATUS output.                                                                                                                                                                   |
| **mysql.innodb.mem\_recovery\_system**(gauge)                       | As shown in the BUFFER POOL AND MEMORY section of the SHOW ENGINE INNODB STATUS output.                                                                                                                                                                   |
| **mysql.innodb.mem\_total**(gauge)                                  | As shown in the BUFFER POOL AND MEMORY section of the SHOW ENGINE INNODB STATUS output.*Shown as byte*                                                                                                                                                    |
| **mysql.innodb.mutex\_os\_waits**(gauge)                            | The rate of mutex OS waits. Only available in MySQL 5.6 and 5.7.*Shown as event*                                                                                                                                                                          |
| **mysql.innodb.mutex\_spin\_rounds**(gauge)                         | The rate of mutex spin rounds. Only available in MySQL 5.6 and 5.7.*Shown as event*                                                                                                                                                                       |
| **mysql.innodb.mutex\_spin\_waits**(gauge)                          | The rate of mutex spin waits. Only available in MySQL 5.6 and 5.7.*Shown as event*                                                                                                                                                                        |
| **mysql.innodb.os\_file\_fsyncs**(gauge)                            | (Delta) The total number of fsync() operations performed by InnoDB.*Shown as operation*                                                                                                                                                                   |
| **mysql.innodb.os\_file\_reads**(gauge)                             | (Delta) The total number of files reads performed by read threads within InnoDB.*Shown as operation*                                                                                                                                                      |
| **mysql.innodb.os\_file\_writes**(gauge)                            | (Delta) The total number of file writes performed by write threads within InnoDB.*Shown as operation*                                                                                                                                                     |
| **mysql.innodb.os\_log\_fsyncs**(gauge)                             | The rate of fsync writes to the log file.*Shown as write*                                                                                                                                                                                                 |
| **mysql.innodb.os\_log\_pending\_fsyncs**(gauge)                    | Number of pending InnoDB log fsync (sync-to-disk) requests.*Shown as operation*                                                                                                                                                                           |
| **mysql.innodb.os\_log\_pending\_writes**(gauge)                    | Number of pending InnoDB log writes.*Shown as write*                                                                                                                                                                                                      |
| **mysql.innodb.os\_log\_written**(gauge)                            | Number of bytes written to the InnoDB log.*Shown as byte*                                                                                                                                                                                                 |
| **mysql.innodb.pages\_created**(gauge)                              | Number of InnoDB pages created.*Shown as page*                                                                                                                                                                                                            |
| **mysql.innodb.pages\_read**(gauge)                                 | Number of InnoDB pages read.*Shown as page*                                                                                                                                                                                                               |
| **mysql.innodb.pages\_written**(gauge)                              | Number of InnoDB pages written.*Shown as page*                                                                                                                                                                                                            |
| **mysql.innodb.pending\_aio\_log\_ios**(gauge)                      | As shown in the FILE I/O section of the SHOW ENGINE INNODB STATUS output.                                                                                                                                                                                 |
| **mysql.innodb.pending\_aio\_sync\_ios**(gauge)                     | As shown in the FILE I/O section of the SHOW ENGINE INNODB STATUS output.                                                                                                                                                                                 |
| **mysql.innodb.pending\_buffer\_pool\_flushes**(gauge)              | As shown in the FILE I/O section of the SHOW ENGINE INNODB STATUS output.*Shown as flush*                                                                                                                                                                 |
| **mysql.innodb.pending\_checkpoint\_writes**(gauge)                 | As shown in the FILE I/O section of the SHOW ENGINE INNODB STATUS output.                                                                                                                                                                                 |
| **mysql.innodb.pending\_ibuf\_aio\_reads**(gauge)                   | As shown in the FILE I/O section of the SHOW ENGINE INNODB STATUS output.                                                                                                                                                                                 |
| **mysql.innodb.pending\_log\_flushes**(gauge)                       | As shown in the FILE I/O section of the SHOW ENGINE INNODB STATUS output. Only available in MySQL 5.6 and 5.7.*Shown as flush*                                                                                                                            |
| **mysql.innodb.pending\_log\_writes**(gauge)                        | As shown in the FILE I/O section of the SHOW ENGINE INNODB STATUS output. Only available in MySQL 5.6 and 5.7.*Shown as write*                                                                                                                            |
| **mysql.innodb.pending\_normal\_aio\_reads**(gauge)                 | As shown in the FILE I/O section of the SHOW ENGINE INNODB STATUS output.*Shown as read*                                                                                                                                                                  |
| **mysql.innodb.pending\_normal\_aio\_writes**(gauge)                | As shown in the FILE I/O section of the SHOW ENGINE INNODB STATUS output.*Shown as write*                                                                                                                                                                 |
| **mysql.innodb.queries\_inside**(gauge)                             | As shown in the FILE I/O section of the SHOW ENGINE INNODB STATUS output.*Shown as query*                                                                                                                                                                 |
| **mysql.innodb.queries\_queued**(gauge)                             | As shown in the FILE I/O section of the SHOW ENGINE INNODB STATUS output.*Shown as query*                                                                                                                                                                 |
| **mysql.innodb.read\_views**(gauge)                                 | As shown in the FILE I/O section of the SHOW ENGINE INNODB STATUS output.                                                                                                                                                                                 |
| **mysql.innodb.row\_lock\_current\_waits**(gauge)                   | The number of row locks currently being waited for by operations on InnoDB tables.                                                                                                                                                                        |
| **mysql.innodb.row\_lock\_time**(gauge)                             | The time spent acquiring row locks.*Shown as millisecond*                                                                                                                                                                                                 |
| **mysql.innodb.row\_lock\_waits**(gauge)                            | The number of times per second a row lock had to be waited for.*Shown as event*                                                                                                                                                                           |
| **mysql.innodb.rows\_deleted**(gauge)                               | Number of rows deleted from InnoDB tables.*Shown as row*                                                                                                                                                                                                  |
| **mysql.innodb.rows\_inserted**(gauge)                              | Number of rows inserted into InnoDB tables.*Shown as row*                                                                                                                                                                                                 |
| **mysql.innodb.rows\_read**(gauge)                                  | Number of rows read from InnoDB tables.*Shown as row*                                                                                                                                                                                                     |
| **mysql.innodb.rows\_updated**(gauge)                               | Number of rows updated in InnoDB tables.*Shown as row*                                                                                                                                                                                                    |
| **mysql.innodb.s\_lock\_os\_waits**(gauge)                          | As shown in the SEMAPHORES section of the SHOW ENGINE INNODB STATUS output                                                                                                                                                                                |
| **mysql.innodb.s\_lock\_spin\_rounds**(gauge)                       | As shown in the SEMAPHORES section of the SHOW ENGINE INNODB STATUS output.                                                                                                                                                                               |
| **mysql.innodb.s\_lock\_spin\_waits**(gauge)                        | As shown in the SEMAPHORES section of the SHOW ENGINE INNODB STATUS output.*Shown as wait*                                                                                                                                                                |
| **mysql.innodb.semaphore\_wait\_time**(gauge)                       | Semaphore wait time                                                                                                                                                                                                                                       |
| **mysql.innodb.semaphore\_waits**(gauge)                            | The number semaphore currently being waited for by operations on InnoDB tables.                                                                                                                                                                           |
| **mysql.innodb.tables\_in\_use**(gauge)                             | Tables in use*Shown as operation*                                                                                                                                                                                                                         |
| **mysql.innodb.x\_lock\_os\_waits**(gauge)                          | As shown in the SEMAPHORES section of the SHOW ENGINE INNODB STATUS output.*Shown as wait*                                                                                                                                                                |
| **mysql.innodb.x\_lock\_spin\_rounds**(gauge)                       | As shown in the SEMAPHORES section of the SHOW ENGINE INNODB STATUS output.                                                                                                                                                                               |
| **mysql.innodb.x\_lock\_spin\_waits**(gauge)                        | As shown in the SEMAPHORES section of the SHOW ENGINE INNODB STATUS output.*Shown as wait*                                                                                                                                                                |
| **mysql.myisam.key\_buffer\_bytes\_unflushed**(gauge)               | MyISAM key buffer bytes unflushed.*Shown as byte*                                                                                                                                                                                                         |
| **mysql.myisam.key\_buffer\_bytes\_used**(gauge)                    | MyISAM key buffer bytes used.*Shown as byte*                                                                                                                                                                                                              |
| **mysql.myisam.key\_buffer\_size**(gauge)                           | Size of the buffer used for index blocks.*Shown as byte*                                                                                                                                                                                                  |
| **mysql.myisam.key\_read\_requests**(gauge)                         | The number of requests to read a key block from the MyISAM key cache.*Shown as read*                                                                                                                                                                      |
| **mysql.myisam.key\_reads**(gauge)                                  | The number of physical reads of a key block from disk into the MyISAM key cache. If `key_reads` is large, then your key_buffer_size value is probably too small. The cache miss rate can be calculated as `key_reads`/`key_read_requests`.*Shown as read* |
| **mysql.myisam.key\_write\_requests**(gauge)                        | The number of requests to write a key block to the MyISAM key cache.*Shown as write*                                                                                                                                                                      |
| **mysql.myisam.key\_writes**(gauge)                                 | The number of physical writes of a key block from the MyISAM key cache to disk.*Shown as write*                                                                                                                                                           |
| **mysql.net.aborted\_clients**(gauge)                               | The number of connections that were aborted because the client died without closing the connection properly.*Shown as connection*                                                                                                                         |
| **mysql.net.aborted\_connects**(gauge)                              | The number of failed attempts to connect to the MySQL server.*Shown as connection*                                                                                                                                                                        |
| **mysql.net.connections**(gauge)                                    | The rate of connections to the server.*Shown as connection*                                                                                                                                                                                               |
| **mysql.net.max\_connections**(gauge)                               | The maximum number of connections that have been in use simultaneously since the server started.*Shown as connection*                                                                                                                                     |
| **mysql.net.max\_connections\_available**(gauge)                    | The maximum permitted number of simultaneous client connections.*Shown as connection*                                                                                                                                                                     |
| **mysql.performance.bytes\_received**(gauge)                        | The number of bytes received from all clients.*Shown as byte*                                                                                                                                                                                             |
| **mysql.performance.bytes\_sent**(gauge)                            | The number of bytes sent to all clients.*Shown as byte*                                                                                                                                                                                                   |
| **mysql.performance.com\_delete**(gauge)                            | The rate of delete statements.*Shown as query*                                                                                                                                                                                                            |
| **mysql.performance.com\_delete\_multi**(gauge)                     | The rate of delete-multi statements.*Shown as query*                                                                                                                                                                                                      |
| **mysql.performance.com\_insert**(gauge)                            | The rate of insert statements.*Shown as query*                                                                                                                                                                                                            |
| **mysql.performance.com\_insert\_select**(gauge)                    | The rate of insert-select statements.*Shown as query*                                                                                                                                                                                                     |
| **mysql.performance.com\_load**(gauge)                              | The rate of load statements.*Shown as query*                                                                                                                                                                                                              |
| **mysql.performance.com\_replace**(gauge)                           | The rate of replace statements.*Shown as query*                                                                                                                                                                                                           |
| **mysql.performance.com\_replace\_select**(gauge)                   | The rate of replace-select statements.*Shown as query*                                                                                                                                                                                                    |
| **mysql.performance.com\_select**(gauge)                            | The rate of select statements.*Shown as query*                                                                                                                                                                                                            |
| **mysql.performance.com\_update**(gauge)                            | The rate of update statements.*Shown as query*                                                                                                                                                                                                            |
| **mysql.performance.com\_update\_multi**(gauge)                     | The rate of update-multi.*Shown as query*                                                                                                                                                                                                                 |
| **mysql.performance.cpu\_time**(gauge)                              | Percentage of CPU time spent by MySQL.*Shown as percent*                                                                                                                                                                                                  |
| **mysql.performance.created\_tmp\_disk\_tables**(gauge)             | The rate of internal on-disk temporary tables created by second by the server while executing statements.*Shown as table*                                                                                                                                 |
| **mysql.performance.created\_tmp\_files**(gauge)                    | The rate of temporary files created by second.*Shown as file*                                                                                                                                                                                             |
| **mysql.performance.created\_tmp\_tables**(gauge)                   | The rate of internal temporary tables created by second by the server while executing statements.*Shown as table*                                                                                                                                         |
| **mysql.performance.digest\_95th\_percentile.avg\_us**(gauge)       | Query response time 95th percentile per schema.*Shown as microsecond*                                                                                                                                                                                     |
| **mysql.performance.errors\_raised**(count)                         | The number of errors raised per error code and name. Tags: `error_number`, `error_name` (DBM only)*Shown as error*                                                                                                                                        |
| **mysql.performance.handler\_commit**(gauge)                        | The number of internal COMMIT statements.*Shown as operation*                                                                                                                                                                                             |
| **mysql.performance.handler\_delete**(gauge)                        | The number of internal DELETE statements.*Shown as operation*                                                                                                                                                                                             |
| **mysql.performance.handler\_prepare**(gauge)                       | The number of internal PREPARE statements.*Shown as operation*                                                                                                                                                                                            |
| **mysql.performance.handler\_read\_first**(gauge)                   | The number of internal READ_FIRST statements.*Shown as operation*                                                                                                                                                                                         |
| **mysql.performance.handler\_read\_key**(gauge)                     | The number of internal READ_KEY statements.*Shown as operation*                                                                                                                                                                                           |
| **mysql.performance.handler\_read\_next**(gauge)                    | The number of internal READ_NEXT statements.*Shown as operation*                                                                                                                                                                                          |
| **mysql.performance.handler\_read\_prev**(gauge)                    | The number of internal READ_PREV statements.*Shown as operation*                                                                                                                                                                                          |
| **mysql.performance.handler\_read\_rnd**(gauge)                     | The number of internal READ_RND statements.*Shown as operation*                                                                                                                                                                                           |
| **mysql.performance.handler\_read\_rnd\_next**(gauge)               | The number of internal READ_RND_NEXT statements.*Shown as operation*                                                                                                                                                                                      |
| **mysql.performance.handler\_rollback**(gauge)                      | The number of internal ROLLBACK statements.*Shown as operation*                                                                                                                                                                                           |
| **mysql.performance.handler\_update**(gauge)                        | The number of internal UPDATE statements.*Shown as operation*                                                                                                                                                                                             |
| **mysql.performance.handler\_write**(gauge)                         | The number of internal WRITE statements.*Shown as operation*                                                                                                                                                                                              |
| **mysql.performance.kernel\_time**(gauge)                           | Percentage of CPU time spent in kernel space by MySQL.*Shown as percent*                                                                                                                                                                                  |
| **mysql.performance.key\_cache\_utilization**(gauge)                | The key cache utilization ratio.*Shown as fraction*                                                                                                                                                                                                       |
| **mysql.performance.max\_prepared\_stmt\_count**(gauge)             | The maximum allowed prepared statements on the server.                                                                                                                                                                                                    |
| **mysql.performance.open\_files**(gauge)                            | The number of open files.*Shown as file*                                                                                                                                                                                                                  |
| **mysql.performance.open\_tables**(gauge)                           | The number of of tables that are open.*Shown as table*                                                                                                                                                                                                    |
| **mysql.performance.opened\_tables**(gauge)                         | The number of tables that have been opened. If `opened_tables` is big, your `table_open_cache` value is probably too small.*Shown as table*                                                                                                               |
| **mysql.performance.performance\_schema\_digest\_lost**(gauge)      | The number of digest instances that could not be instrumented in the events_statements_summary_by_digest table. This can be nonzero if the value of performance_schema_digests_size is too small.                                                         |
| **mysql.performance.prepared\_stmt\_count**(gauge)                  | The current number of prepared statements.*Shown as query*                                                                                                                                                                                                |
| **mysql.performance.qcache.utilization**(gauge)                     | Percentage of queries served from query cache since server start.*Shown as percent*                                                                                                                                                                       |
| **mysql.performance.qcache.utilization.instant**(gauge)             | Percentage of queries served from query cache since last check.*Shown as percent*                                                                                                                                                                         |
| **mysql.performance.qcache\_free\_blocks**(gauge)                   | The number of free memory blocks in the query cache.*Shown as block*                                                                                                                                                                                      |
| **mysql.performance.qcache\_free\_memory**(gauge)                   | The amount of free memory for the query cache.*Shown as byte*                                                                                                                                                                                             |
| **mysql.performance.qcache\_hits**(gauge)                           | The rate of query cache hits.*Shown as hit*                                                                                                                                                                                                               |
| **mysql.performance.qcache\_inserts**(gauge)                        | The number of queries added to the query cache.*Shown as query*                                                                                                                                                                                           |
| **mysql.performance.qcache\_lowmem\_prunes**(gauge)                 | The number of queries that were deleted from the query cache because of low memory.*Shown as query*                                                                                                                                                       |
| **mysql.performance.qcache\_not\_cached**(gauge)                    | The number of noncached queries (not cacheable, or not cached due to the `query_cache_type` setting).*Shown as query*                                                                                                                                     |
| **mysql.performance.qcache\_queries\_in\_cache**(gauge)             | The number of queries registered in the query cache.*Shown as query*                                                                                                                                                                                      |
| **mysql.performance.qcache\_size**(gauge)                           | The amount of memory allocated for caching query results.*Shown as byte*                                                                                                                                                                                  |
| **mysql.performance.qcache\_total\_blocks**(gauge)                  | The total number of blocks in the query cache.*Shown as block*                                                                                                                                                                                            |
| **mysql.performance.queries**(gauge)                                | The rate of queries.*Shown as query*                                                                                                                                                                                                                      |
| **mysql.performance.query\_run\_time.avg**(gauge)                   | Avg query response time per schema.*Shown as microsecond*                                                                                                                                                                                                 |
| **mysql.performance.questions**(gauge)                              | The rate of statements executed by the server.*Shown as query*                                                                                                                                                                                            |
| **mysql.performance.select\_full\_join**(gauge)                     | The number of joins that perform table scans because they do not use indexes. If this value is not 0, you should carefully check the indexes of your tables.*Shown as operation*                                                                          |
| **mysql.performance.select\_full\_range\_join**(gauge)              | The number of joins that used a range search on a reference table.*Shown as operation*                                                                                                                                                                    |
| **mysql.performance.select\_range**(gauge)                          | The number of joins that used ranges on the first table. This is normally not a critical issue even if the value is quite large.*Shown as operation*                                                                                                      |
| **mysql.performance.select\_range\_check**(gauge)                   | The number of joins without keys that check for key usage after each row. If this is not 0, you should carefully check the indexes of your tables.*Shown as operation*                                                                                    |
| **mysql.performance.select\_scan**(gauge)                           | The number of joins that did a full scan of the first table.*Shown as operation*                                                                                                                                                                          |
| **mysql.performance.slow\_queries**(gauge)                          | The rate of slow queries (log queries that exceed a particular execution time).*Shown as query*                                                                                                                                                           |
| **mysql.performance.sort\_merge\_passes**(gauge)                    | The number of merge passes that the sort algorithm has had to do. If this value is large, you should consider increasing the value of the `sort_buffer_size` system variable.*Shown as operation*                                                         |
| **mysql.performance.sort\_range**(gauge)                            | The number of sorts that were done using ranges.*Shown as operation*                                                                                                                                                                                      |
| **mysql.performance.sort\_rows**(gauge)                             | The number of sorted rows.*Shown as operation*                                                                                                                                                                                                            |
| **mysql.performance.sort\_scan**(gauge)                             | The number of sorts that were done by scanning the table.*Shown as operation*                                                                                                                                                                             |
| **mysql.performance.table\_cache\_hits**(gauge)                     | The number of hits for open tables cache lookups.*Shown as hit*                                                                                                                                                                                           |
| **mysql.performance.table\_cache\_misses**(gauge)                   | The number of misses for open tables cache lookups.*Shown as miss*                                                                                                                                                                                        |
| **mysql.performance.table\_locks\_immediate**(gauge)                | The number of times that a request for a table lock could be granted immediately.                                                                                                                                                                         |
| **mysql.performance.table\_locks\_immediate.rate**(gauge)           | The rate of times that a request for a table lock could be granted immediately.                                                                                                                                                                           |
| **mysql.performance.table\_locks\_waited**(gauge)                   | The total number of times that a request for a table lock could not be granted immediately and a wait was needed.                                                                                                                                         |
| **mysql.performance.table\_locks\_waited.rate**(gauge)              | The rate of times that a request for a table lock could not be granted immediately and a wait was needed.                                                                                                                                                 |
| **mysql.performance.table\_open\_cache**(gauge)                     | The number of open tables for all threads. Increasing this value increases the number of file descriptors that mysqld requires.                                                                                                                           |
| **mysql.performance.thread\_cache\_size**(gauge)                    | How many threads the server should cache for reuse. When a client disconnects, the client's threads are put in the cache if there are fewer than `thread_cache_size` threads there.*Shown as byte*                                                        |
| **mysql.performance.threads\_cached**(gauge)                        | The number of threads in the thread cache.*Shown as thread*                                                                                                                                                                                               |
| **mysql.performance.threads\_connected**(gauge)                     | The number of currently open connections.*Shown as connection*                                                                                                                                                                                            |
| **mysql.performance.threads\_created**(count)                       | The number of threads created to handle connections. If `threads_created` is big, you may want to increase the `thread_cache_size` value.*Shown as thread*                                                                                                |
| **mysql.performance.threads\_running**(gauge)                       | The number of threads that are not sleeping.*Shown as thread*                                                                                                                                                                                             |
| **mysql.performance.user\_connections**(gauge)                      | The number of user connections. Tags: `processlist_db`, `processlist_host`, `processlist_state`, `processlist_user`*Shown as connection*                                                                                                                  |
| **mysql.performance.user\_time**(gauge)                             | Percentage of CPU time spent in user space by MySQL.*Shown as percent*                                                                                                                                                                                    |
| **mysql.performance.wait\_event.avg\_time**(gauge)                  | Average wait time per occurrence of a wait event (DBM only). Tagged by `wait_event`.*Shown as nanosecond*                                                                                                                                                 |
| **mysql.performance.wait\_event.count**(count)                      | Total number of occurrences of a wait event (DBM only). Tagged by `wait_event`.*Shown as event*                                                                                                                                                           |
| **mysql.performance.wait\_event.max\_time**(gauge)                  | Maximum single-occurrence wait time for a wait event (DBM only). Tagged by `wait_event`.*Shown as nanosecond*                                                                                                                                             |
| **mysql.performance.wait\_event.time**(count)                       | Total accumulated wait time for a wait event (DBM only). Tagged by `wait_event`.*Shown as nanosecond*                                                                                                                                                     |
| **mysql.queries.count**(count)                                      | The total count of executed queries per normalized query and schema. (DBM only)*Shown as query*                                                                                                                                                           |
| **mysql.queries.created\_tmp\_disk\_tables**(count)                 | The total count of temporary tables that exceeded tmp_table_size and were written to disk per normalized query and schema. (DBM only)*Shown as table*                                                                                                     |
| **mysql.queries.created\_tmp\_tables**(count)                       | The total count of in-memory temporary tables created during execution per normalized query and schema. (DBM only)*Shown as table*                                                                                                                        |
| **mysql.queries.errors**(count)                                     | The total count of queries run with an error per normalized query and schema. (DBM only)*Shown as error*                                                                                                                                                  |
| **mysql.queries.lock\_time**(count)                                 | The total time spent waiting on locks per normalized query and schema. (DBM only)*Shown as nanosecond*                                                                                                                                                    |
| **mysql.queries.no\_good\_index\_used**(count)                      | The total count of queries which used a sub-optimal index per normalized query and schema. (DBM only)*Shown as query*                                                                                                                                     |
| **mysql.queries.no\_index\_used**(count)                            | The total count of queries which do not use an index per normalized query and schema. (DBM only)*Shown as query*                                                                                                                                          |
| **mysql.queries.rows\_affected**(count)                             | The number of rows mutated per normalized query and schema. (DBM only)*Shown as row*                                                                                                                                                                      |
| **mysql.queries.rows\_examined**(count)                             | The number of rows examined per normalized query and schema. (DBM only)*Shown as row*                                                                                                                                                                     |
| **mysql.queries.rows\_sent**(count)                                 | The number of rows sent per normalized query and schema. (DBM only)*Shown as row*                                                                                                                                                                         |
| **mysql.queries.select\_full\_join**(count)                         | The total count of full table scans on a joined table per normalized query and schema. (DBM only)                                                                                                                                                         |
| **mysql.queries.select\_full\_range\_join**(count)                  | The total count of joins that used a range search on a referenced table per normalized query and schema. (DBM only)*Shown as operation*                                                                                                                   |
| **mysql.queries.select\_range**(count)                              | The total count of joins that used a range on the first table per normalized query and schema. (DBM only)*Shown as operation*                                                                                                                             |
| **mysql.queries.select\_range\_check**(count)                       | The total count of joins where the optimizer re-evaluates index usefulness per row per normalized query and schema. (DBM only)*Shown as operation*                                                                                                        |
| **mysql.queries.select\_scan**(count)                               | The total count of full table scans on the first table per normalized query and schema. (DBM only)                                                                                                                                                        |
| **mysql.queries.sort\_merge\_passes**(count)                        | The total count of multi-pass sort operations that spilled to disk per normalized query and schema. (DBM only)*Shown as operation*                                                                                                                        |
| **mysql.queries.sort\_range**(count)                                | The total count of sorts performed using an index range per normalized query and schema. (DBM only)*Shown as operation*                                                                                                                                   |
| **mysql.queries.sort\_rows**(count)                                 | The total number of rows sorted per normalized query and schema. (DBM only)*Shown as row*                                                                                                                                                                 |
| **mysql.queries.sort\_scan**(count)                                 | The total count of sorts performed via full table scan per normalized query and schema. (DBM only)*Shown as operation*                                                                                                                                    |
| **mysql.queries.time**(count)                                       | The total query execution time per normalized query and schema. (DBM only)*Shown as nanosecond*                                                                                                                                                           |
| **mysql.replication.group.conflicts\_detected**(gauge)              | The number of transactions that have not passed the conflict detection check.*Shown as transaction*                                                                                                                                                       |
| **mysql.replication.group.member\_status**(gauge)                   | Information about the node status in a group replication environment, always equal to 1.                                                                                                                                                                  |
| **mysql.replication.group.transactions**(gauge)                     | The number of transactions in the queue pending conflict detection checks.*Shown as transaction*                                                                                                                                                          |
| **mysql.replication.group.transactions\_applied**(gauge)            | Number of transactions this member has received from the group and applied.*Shown as transaction*                                                                                                                                                         |
| **mysql.replication.group.transactions\_check**(gauge)              | The number of transactions that have been checked for conflicts.*Shown as transaction*                                                                                                                                                                    |
| **mysql.replication.group.transactions\_in\_applier\_queue**(gauge) | The number of transactions that this member has received from the replication group which are waiting to be applied.*Shown as transaction*                                                                                                                |
| **mysql.replication.group.transactions\_proposed**(gauge)           | The number of transactions which originated on this member and were sent to the group.*Shown as transaction*                                                                                                                                              |
| **mysql.replication.group.transactions\_rollback**(gauge)           | The number of transactions which originated on this member and were rolled back by the group.*Shown as transaction*                                                                                                                                       |
| **mysql.replication.group.transactions\_validating**(gauge)         | The number of transaction rows which can be used for certification, but have not been garbage collected.*Shown as transaction*                                                                                                                            |
| **mysql.replication.replicas\_connected**(gauge)                    | Number of replicas connected to a replication source.                                                                                                                                                                                                     |
| **mysql.replication.seconds\_behind\_master**(gauge)                | The lag in seconds between the master and the slave.*Shown as second*                                                                                                                                                                                     |
| **mysql.replication.seconds\_behind\_source**(gauge)                | The lag in seconds between the source and the replica.*Shown as second*                                                                                                                                                                                   |
| **mysql.replication.slave\_running**(gauge)                         | Deprecated. Use service check mysql.replication.replica_running instead. A boolean showing if this server is a replication slave / master that is running.                                                                                                |
| **mysql.replication.slaves\_connected**(gauge)                      | Deprecated. Use `mysql.replication.replicas_connected` instead. Number of slaves connected to a replication master.                                                                                                                                       |

The check does not collect all metrics by default. Set the following boolean configuration options to `true` to enable the respective metrics:

`extra_status_metrics` adds the following metrics:

| Metric name                                  | Metric type |
| -------------------------------------------- | ----------- |
| mysql.binlog.cache_disk_use                  | GAUGE       |
| mysql.binlog.cache_use                       | GAUGE       |
| mysql.performance.handler_commit             | RATE        |
| mysql.performance.handler_delete             | RATE        |
| mysql.performance.handler_prepare            | RATE        |
| mysql.performance.handler_read_first         | RATE        |
| mysql.performance.handler_read_key           | RATE        |
| mysql.performance.handler_read_next          | RATE        |
| mysql.performance.handler_read_prev          | RATE        |
| mysql.performance.handler_read_rnd           | RATE        |
| mysql.performance.handler_read_rnd_next      | RATE        |
| mysql.performance.handler_rollback           | RATE        |
| mysql.performance.handler_update             | RATE        |
| mysql.performance.handler_write              | RATE        |
| mysql.performance.opened_tables              | RATE        |
| mysql.performance.qcache_total_blocks        | GAUGE       |
| mysql.performance.qcache_free_blocks         | GAUGE       |
| mysql.performance.qcache_free_memory         | GAUGE       |
| mysql.performance.qcache_not_cached          | RATE        |
| mysql.performance.qcache_queries_in_cache    | GAUGE       |
| mysql.performance.select_full_join           | RATE        |
| mysql.performance.select_full_range_join     | RATE        |
| mysql.performance.select_range               | RATE        |
| mysql.performance.select_range_check         | RATE        |
| mysql.performance.select_scan                | RATE        |
| mysql.performance.sort_merge_passes          | RATE        |
| mysql.performance.sort_range                 | RATE        |
| mysql.performance.sort_rows                  | RATE        |
| mysql.performance.sort_scan                  | RATE        |
| mysql.performance.table_locks_immediate      | GAUGE       |
| mysql.performance.table_locks_immediate.rate | RATE        |
| mysql.performance.threads_cached             | GAUGE       |
| mysql.performance.threads_created            | MONOTONIC   |

`extra_innodb_metrics` adds the following metrics:

| Metric name                                 | Metric type |
| ------------------------------------------- | ----------- |
| mysql.innodb.active_transactions            | GAUGE       |
| mysql.innodb.buffer_pool_data               | GAUGE       |
| mysql.innodb.buffer_pool_pages_data         | GAUGE       |
| mysql.innodb.buffer_pool_pages_dirty        | GAUGE       |
| mysql.innodb.buffer_pool_pages_flushed      | RATE        |
| mysql.innodb.buffer_pool_pages_free         | GAUGE       |
| mysql.innodb.buffer_pool_pages_total        | GAUGE       |
| mysql.innodb.buffer_pool_read_ahead         | RATE        |
| mysql.innodb.buffer_pool_read_ahead_evicted | RATE        |
| mysql.innodb.buffer_pool_read_ahead_rnd     | GAUGE       |
| mysql.innodb.buffer_pool_wait_free          | MONOTONIC   |
| mysql.innodb.buffer_pool_write_requests     | RATE        |
| mysql.innodb.checkpoint_age                 | GAUGE       |
| mysql.innodb.current_transactions           | GAUGE       |
| mysql.innodb.data_fsyncs                    | RATE        |
| mysql.innodb.data_pending_fsyncs            | GAUGE       |
| mysql.innodb.data_pending_reads             | GAUGE       |
| mysql.innodb.data_pending_writes            | GAUGE       |
| mysql.innodb.data_read                      | RATE        |
| mysql.innodb.data_written                   | RATE        |
| mysql.innodb.dblwr_pages_written            | RATE        |
| mysql.innodb.dblwr_writes                   | RATE        |
| mysql.innodb.hash_index_cells_total         | GAUGE       |
| mysql.innodb.hash_index_cells_used          | GAUGE       |
| mysql.innodb.history_list_length            | GAUGE       |
| mysql.innodb.ibuf_free_list                 | GAUGE       |
| mysql.innodb.ibuf_merged                    | RATE        |
| mysql.innodb.ibuf_merged_delete_marks       | RATE        |
| mysql.innodb.ibuf_merged_deletes            | RATE        |
| mysql.innodb.ibuf_merged_inserts            | RATE        |
| mysql.innodb.ibuf_merges                    | RATE        |
| mysql.innodb.ibuf_segment_size              | GAUGE       |
| mysql.innodb.ibuf_size                      | GAUGE       |
| mysql.innodb.lock_structs                   | GAUGE       |
| mysql.innodb.locked_tables                  | GAUGE       |
| mysql.innodb.locked_transactions            | GAUGE       |
| mysql.innodb.log_waits                      | RATE        |
| mysql.innodb.log_write_requests             | RATE        |
| mysql.innodb.log_writes                     | RATE        |
| mysql.innodb.lsn_current                    | RATE        |
| mysql.innodb.lsn_flushed                    | RATE        |
| mysql.innodb.lsn_last_checkpoint            | RATE        |
| mysql.innodb.mem_adaptive_hash              | GAUGE       |
| mysql.innodb.mem_additional_pool            | GAUGE       |
| mysql.innodb.mem_dictionary                 | GAUGE       |
| mysql.innodb.mem_file_system                | GAUGE       |
| mysql.innodb.mem_lock_system                | GAUGE       |
| mysql.innodb.mem_page_hash                  | GAUGE       |
| mysql.innodb.mem_recovery_system            | GAUGE       |
| mysql.innodb.mem_thread_hash                | GAUGE       |
| mysql.innodb.mem_total                      | GAUGE       |
| mysql.innodb.os_file_fsyncs                 | RATE        |
| mysql.innodb.os_file_reads                  | RATE        |
| mysql.innodb.os_file_writes                 | RATE        |
| mysql.innodb.os_log_pending_fsyncs          | GAUGE       |
| mysql.innodb.os_log_pending_writes          | GAUGE       |
| mysql.innodb.os_log_written                 | RATE        |
| mysql.innodb.pages_created                  | RATE        |
| mysql.innodb.pages_read                     | RATE        |
| mysql.innodb.pages_written                  | RATE        |
| mysql.innodb.pending_aio_log_ios            | GAUGE       |
| mysql.innodb.pending_aio_sync_ios           | GAUGE       |
| mysql.innodb.pending_buffer_pool_flushes    | GAUGE       |
| mysql.innodb.pending_checkpoint_writes      | GAUGE       |
| mysql.innodb.pending_ibuf_aio_reads         | GAUGE       |
| mysql.innodb.pending_log_flushes            | GAUGE       |
| mysql.innodb.pending_log_writes             | GAUGE       |
| mysql.innodb.pending_normal_aio_reads       | GAUGE       |
| mysql.innodb.pending_normal_aio_writes      | GAUGE       |
| mysql.innodb.queries_inside                 | GAUGE       |
| mysql.innodb.queries_queued                 | GAUGE       |
| mysql.innodb.read_views                     | GAUGE       |
| mysql.innodb.rows_deleted                   | RATE        |
| mysql.innodb.rows_inserted                  | RATE        |
| mysql.innodb.rows_read                      | RATE        |
| mysql.innodb.rows_updated                   | RATE        |
| mysql.innodb.s_lock_os_waits                | RATE        |
| mysql.innodb.s_lock_spin_rounds             | RATE        |
| mysql.innodb.s_lock_spin_waits              | RATE        |
| mysql.innodb.semaphore_wait_time            | GAUGE       |
| mysql.innodb.semaphore_waits                | GAUGE       |
| mysql.innodb.tables_in_use                  | GAUGE       |
| mysql.innodb.x_lock_os_waits                | RATE        |
| mysql.innodb.x_lock_spin_rounds             | RATE        |
| mysql.innodb.x_lock_spin_waits              | RATE        |

`extra_performance_metrics` adds the following metrics:

| Metric name                                     | Metric type |
| ----------------------------------------------- | ----------- |
| mysql.performance.query_run_time.avg            | GAUGE       |
| mysql.performance.digest_95th_percentile.avg_us | GAUGE       |

`schema_size_metrics` adds the following metric:

| Metric name            | Metric type |
| ---------------------- | ----------- |
| mysql.info.schema.size | GAUGE       |

### Events{% #events %}

The MySQL check does not include any events.

### Service Checks{% #service-checks %}

**mysql.can\_connect**

Returns `CRITICAL` if the Agent is unable to connect to the monitored MySQL instance. Returns `OK` otherwise.

*Statuses: ok, critical*

**mysql.replication.slave\_running**

Deprecated. Returns CRITICAL for a replica that's not running Slave_IO_Running or Slave_SQL_Running, WARNING if one of the two is not running. Returns `OK` otherwise.

*Statuses: ok, warning, critical*

**mysql.replication.replica\_running**

Returns CRITICAL for a replica that's not running Replica_IO_Running or Replica_SQL_Running, WARNING if one of the two is not running. Returns `OK` otherwise.

*Statuses: ok, warning, critical*

**mysql.replication.group.status**

Returns `OK` if the host status is ONLINE, returns `CRITICAL` otherwise.

*Statuses: ok, critical*

## Troubleshooting{% #troubleshooting %}

- [MySQL Localhost Error - Localhost VS 127.0.0.1](https://docs.datadoghq.com/integrations/faq/mysql-localhost-error-localhost-vs-127-0-0-1.md)
- [Can I set up the dd-agent MySQL check on my Google CloudSQL?](https://docs.datadoghq.com/integrations/faq/can-i-set-up-the-dd-agent-mysql-check-on-my-google-cloudsql.md)
- [MySQL Custom Queries](https://docs.datadoghq.com/integrations/faq/how-to-collect-metrics-from-custom-mysql-queries.md)
- [Database user lacks privileges](https://docs.datadoghq.com/integrations/faq/database-user-lacks-privileges.md)

## Further Reading{% #further-reading %}

- [Monitoring MySQL performance metrics](https://www.datadoghq.com/blog/monitoring-mysql-performance-metrics)
