• Log inFree account

MySQL monitoring integration

Our MySQL integration collects and sends inventory and metrics from your MySQL database to our platform, where you can see the health of your database server and analyze metric data so that you can easily find the source of any problems.

To install the MySQL monitoring integration, you must run through the following steps:

  1. Enabling your MySQL Server.
  2. Configure the integration.
  3. Install and activate the integration.
  4. Find and use data.
  5. Optionally, see MySQL's configuration settings.

Compatibility and requirements

MySQL versions

Our integration is compatible with MySQL version 5.6 or higher.

Important

For MySQL v8.0 and higher we do not support the following metrics: cluster.slaveRunning, db.qCacheFreeMemoryBytes, db.qCacheHitRatio, and db.qCacheNotCachedPerSecond.

Supported operating systems

  • Windows Windows
  • Linux Linux

For a comprehensive list of specific Windows and Linux versions, check the table of compatible operating systems.

System requirements

Enabling your MySQL Server

To capture data from the MySQL integration, you must first create a MySQL user with replication and select permissions to allow the integration to fetch metrics.

  1. From the command line, create a user newrelic@localhost with a specific password by running:

    bash
    $
    sudo mysql -e "CREATE USER 'newrelic'@'localhost' IDENTIFIED BY $YOUR_PASSWORD WITH MAX_USER_CONNECTIONS 5;"
  2. Grant replication privileges to newrelic@localhost, with a maximum of 5 connections, by running:

    bash
    $
    sudo mysql -e "GRANT REPLICATION CLIENT ON *.* TO 'newrelic'@'localhost' WITH MAX_USER_CONNECTIONS 5;"
  3. Grant privileges to newrelic@localhost, with a maximum of 5 connections, by running:

    bash
    $
    sudo mysql -e "GRANT SELECT ON *.* TO 'newrelic'@'localhost' WITH MAX_USER_CONNECTIONS 5;"

Configure the integration

There are several ways to configure the integration, depending on how it was installed:

  • If enabled via KubernetesKubernetes, see Monitor services running on Kubernetes.
  • If enabled via ECSAmazon ECS, see Monitor services running on ECS.
  • If installed on-host, edit the config in the integration's YAML config file, mysql-config.yml. An integration's YAML-format configuration is where you can place required login credentials and configure how data is collected. Which options you change depend on your setup and preference. The configuration file has common settings applicable to all integrations like interval, timeout, inventory_source. To read all about these common settings refer to our Configuration Format document.

Important

If you are still using our Legacy configuration and definition files, refer to this document for help.

Install and activate the integration

To install the MySQL integration, follow the instructions for your environment:

Linux installation

  1. Follow the instructions for installing an integration, and use nri-mysql as filename.

  2. Change the directory to the integrations configuration folder by running:

    bash
    $
    cd /etc/newrelic-infra/integrations.d
  3. Copy the sample configuration file by running:

    bash
    $
    sudo cp mysql-config.yml.sample mysql-config.yml
  4. Edit the mysql-config.yml configuration file with your favorite editor. Check out some great configuration file examples..

  5. Restart the infrastructure agent. See how to restart the infrastructure agent in different Linux environments.

  6. To enable automatic MySQL error log parsing and forwarding, copy (or rename) the mysql-log.yml.example file to mysql-log.yml. No need to restart the agent.

Example:

sudo cp /etc/newrelic-infra/logging.d/mysql-log.yml.example /etc/newrelic-infra/logging.d/mysql-log.yml

Other environments

Additional notes:

mysql-config.yml sample files

Configuration options for the integration

For more on how to find and use your data, see MySQL's configuration settings.

Find and use data

After you've configured and installed the integration, you can start monitoring:

For more on how to find and use your data, see how to understand integration data.

Metrics collected by the integration

The MySQL integration collects the following metrics:

Copyright © 2022 New Relic Inc.