---
title: Install & configure NRDOT for MySQL monitoring with Chef
source: https://docs.newrelic.com/docs/opentelemetry/db360/mysql/chef
---

You can install and configure the NRDOT Collector for MySQL monitoring using the `newrelic-install` Chef cookbook. The cookbook installs the collector, creates the monitoring user, and configures the collector when you run the `newrelic-install::default` recipe.

## Prerequisites [#prerequisites]

-   A New Relic account with a valid [license key](https://docs.newrelic.com/docs/apis/intro-apis/new-relic-api-keys/#overview-keys).
-   A New Relic [account ID](https://docs.newrelic.com/docs/accounts/accounts-billing/account-structure/account-id).
-   MySQL 5.7 or later.
-   Chef 15 or later.
-   A Linux collector host running Debian/Ubuntu or RHEL/CentOS.
-   For self-hosted MySQL: administrative access to your MySQL server (the `root` account or equivalent), using password-based authentication.
-   For MySQL or Aurora on AWS RDS: network connectivity from the collector host to the RDS endpoint, and the RDS master username and password.
-   Network connectivity to [New Relic OTLP endpoint](https://docs.newrelic.com/docs/opentelemetry/best-practices/opentelemetry-otlp) for your region.

For detailed requirements, refer to [Compatibility and prerequisites](https://docs.newrelic.com/docs/opentelemetry/db360/mysql/compatibility).

## Download the Chef cookbook [#chef-download-cookbook]

Download the `newrelic-install` [Chef cookbook](https://supermarket.chef.io/cookbooks/newrelic-install) from the Chef Supermarket to your chef-repo directory:

```bash
knife supermarket install newrelic-install
```

## Replace the default attributes [#chef-configure]

Replace the default attributes in `attributes/default.rb` with your account details:

**Self-hosted MySQL**

This cookbook monitors one or more MySQL instances from a single collector. Instead of a single host/port/credential set, it reads two files that must already exist on the node: an instances file (YAML) listing every instance to monitor, and a secrets file (`KEY=VALUE`) with an admin login and password for each, indexed to match. See the [CLI install](https://docs.newrelic.com/docs/opentelemetry/db360/mysql/cli/#cli-install) page for the exact file formats.

```ruby
default['newrelic_install']['NEW_RELIC_API_KEY']    = <API key>
default['newrelic_install']['NEW_RELIC_ACCOUNT_ID'] = <Account ID>
default['newrelic_install']['NEW_RELIC_REGION']     = <Region>
default['newrelic_install']['targets'] = [
  'nrdot-collector-mysql'
]
default['newrelic_install']['env']['NR_CLI_MYSQL_CONFIG_PRESET']  = <1 Basic, 2 Advanced, default 1>
default['newrelic_install']['env']['NR_CLI_MYSQL_INSTANCES_FILE'] = <path to the instances YAML file on the node>
default['newrelic_install']['env']['NR_CLI_MYSQL_SECRETS_FILE']   = <path to the secrets file (KEY=VALUE per instance) on the node>
# See all available targets at: https://github.com/newrelic/chef-install
```

> #### ⚠️ IMPORTANT
>
> The cookbook connects to MySQL over TCP using a password, so the admin account in your secrets file must use password-based authentication. On some Debian/Ubuntu installs, `root`@`localhost` defaults to the `auth_socket` plugin (no password, local-socket only), which won't work here. Switch it before running the recipe:
>
> ```bash
> mysql -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '<password>';"
> ```

| Attribute (under `env`)       | Description                                                                                                                | Default |
| ----------------------------- | -------------------------------------------------------------------------------------------------------------------------- | ------- |
| `NR_CLI_MYSQL_CONFIG_PRESET`  | NRDOT configuration: 1 for Basic 2 for Advanced                                                                            | `1`     |
| `NR_CLI_MYSQL_INSTANCES_FILE` | Required. Path to the instances YAML file, already present on the node.                                                    | None    |
| `NR_CLI_MYSQL_SECRETS_FILE`   | Required. Path to the secrets file (`KEY=VALUE`, one admin login/password pair per instance), already present on the node. | None    |

> #### 💡 TIP
>
> No default attribute values are shipped for these variables. Set the ones relevant to your target explicitly via `default['newrelic_install']['env'][...]`.

> #### 💡 TIP
>
> To monitor more than one MySQL instance from this collector, add more entries to the instances file and matching numbered credentials (`_2`, `_3`, ...) to the secrets file. An instance that fails its checks is skipped with a logged reason rather than aborting the whole install.

**MySQL or Aurora on AWS RDS**

This cookbook monitors one or more RDS MySQL or Aurora endpoints from a single collector, using the same instances file / secrets file pattern as self-hosted (both files must already exist on the node).

```ruby
default['newrelic_install']['NEW_RELIC_API_KEY']    = <API key>
default['newrelic_install']['NEW_RELIC_ACCOUNT_ID'] = <Account ID>
default['newrelic_install']['NEW_RELIC_REGION']     = <Region>
default['newrelic_install']['targets'] = [
  'nrdot-collector-mysql-rds'
]
default['newrelic_install']['env']['NR_CLI_MYSQL_CONFIG_PRESET']  = <1 Basic, 2 Advanced, default 1>
default['newrelic_install']['env']['NR_CLI_MYSQL_INSTANCES_FILE'] = <path to the instances YAML file on the node, using RDS endpoints as host>
default['newrelic_install']['env']['NR_CLI_MYSQL_SECRETS_FILE']   = <path to the secrets file (KEY=VALUE per instance) on the node>
# See all available targets at: https://github.com/newrelic/chef-install
```

| Attribute (under `env`)       | Description                                                                                                                        | Default |
| ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ------- |
| `NR_CLI_MYSQL_CONFIG_PRESET`  | NRDOT configuration: 1 for Basic 2 for Advanced                                                                                    | `1`     |
| `NR_CLI_MYSQL_INSTANCES_FILE` | Required. Path to the instances YAML file, using RDS endpoints as `host`, already present on the node.                             | None    |
| `NR_CLI_MYSQL_SECRETS_FILE`   | Required. Path to the secrets file (`KEY=VALUE`, one RDS master username/password pair per instance), already present on the node. | None    |

> #### 💡 TIP
>
> No default attribute values are shipped for these variables. Set the ones relevant to your target explicitly via `default['newrelic_install']['env'][...]`.

> #### 💡 TIP
>
> To monitor more than one RDS MySQL or Aurora endpoint from this collector, add more entries to the instances file and matching numbered credentials to the secrets file. An instance that fails its checks is skipped with a logged reason rather than aborting the whole install.

## Upload the Chef cookbook [#chef-upload-cookbook]

Upload the `newrelic-install` Chef cookbook to your Chef server:

```bash
knife cookbook upload newrelic-install
```

## Update the run list [#chef-run-list]

Add the `newrelic-install` recipe to the run list of a node:

```json
"run_list": [
  "recipe[newrelic-install]"
]
```

## Find and use your data [#find]

Once your data is being collected, you can access comprehensive MySQL database monitoring through the New Relic UI.

To find your MySQL database entity in New Relic:

1.  Go to **[one.newrelic.com](https://one.newrelic.com) > All capabilities > Databases**.
2.  From the **Entity type** dropdown, select **MySQL instance**, then click **Apply**.
3.  Select your MySQL database from the list of entities.

## Related documentation [#related]

[Introduction to MySQL monitoring with NRDOT](https://docs.newrelic.com/docs/opentelemetry/db360/mysql/introduction)

Learn about all the available installation methods for MySQL monitoring with New Relic.

[CLI install](https://docs.newrelic.com/docs/opentelemetry/db360/mysql/cli)

Learn how to install and configure MySQL monitoring with a single New Relic CLI command.

[Ansible install](https://docs.newrelic.com/docs/opentelemetry/db360/mysql/ansible)

Learn how to install and configure MySQL monitoring at scale with the newrelic.newrelic_install Ansible role.

[Helm chart install](https://docs.newrelic.com/docs/opentelemetry/db360/mysql/helm)

Learn how to install and configure MySQL monitoring on Kubernetes with the mysql-otel Helm chart.
