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:
- Enabling your MySQL Server.
- Configure the integration.
- Install and activate the integration.
- Find and use data.
- 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
For a comprehensive list of specific Windows and Linux versions, check the table of compatible operating systems.
System requirements
- A New Relic account. Don't have one? Sign up for free! No credit card required.
- If MySQL is not running on Kubernetes or Amazon ECS, you can install the infrastructure agent on a Linux or Windows OS host or on a host capable of remotely accessing where MySQL is installed. Otherwise:
- If running on Kubernetes, see these requirements.
- If running on Amazon ECS, see these 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.
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;"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;"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 Kubernetes, see Monitor services running on Kubernetes.
- If enabled via Amazon 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 likeinterval
,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
Follow the instructions for installing an integration, and use
nri-mysql
as filename.Change the directory to the integrations configuration folder by running:
bash$cd /etc/newrelic-infra/integrations.dCopy the sample configuration file by running:
bash$sudo cp mysql-config.yml.sample mysql-config.ymlEdit the
mysql-config.yml
configuration file with your favorite editor. Check out some great configuration file examples..Restart the infrastructure agent. See how to restart the infrastructure agent in different Linux environments.
To enable automatic MySQL error log parsing and forwarding, copy (or rename) the
mysql-log.yml.example
file tomysql-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:
- Advanced: Integrations are also available in tarball format to allow for install outside of a package manager.
- On-host integrations do not automatically update. For best results, regularly update the integration package and the infrastructure agent.
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:
- Data from this service, which is reported to an integration dashboard.
- Metrics are attached to the
MysqlSample
event type. You can query this data for troubleshooting purposes or to create custom charts and dashboards.
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: