# Metricbeat for MySQL fails - "missing required field accessing '0.queries'"

**URL:** <https://discuss.elastic.co/t/metricbeat-for-mysql-fails-missing-required-field-accessing-0-queries/271895>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [May 2, 2021, 5:45am UTC](https://discuss.elastic.co/t/metricbeat-for-mysql-fails-missing-required-field-accessing-0-queries/271895 "2021-05-02T05:45:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rudimk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rudimk/32/88084_2.png) [@rudimk](https://discuss.elastic.co/u/rudimk)\
**Post date:** [May 2, 2021, 5:45am UTC](https://discuss.elastic.co/t/metricbeat-for-mysql-fails-missing-required-field-accessing-0-queries/271895/1 "2021-05-02T05:45:51Z")

</div>

Hello!

I'm setting up Metricbeats on Ubuntu 18.04 to track metrics for a MySQL database. Unfortunately, starting the agent fails with the following error:

```auto
May 02 11:08:07 ubuntu metricbeat[69057]: 2021-05-02T11:08:07.990+0530 ERROR instance/beat.go:971 Exiting: 1 error: missing required field accessing '0.queries' (source:'/etc/metricbeat/modules.d/mysql.yml')

```

Here's what the MySQL config for Metricbeats looks like:

```auto
# Module: mysql
# Docs: https://www.elastic.co/guide/en/beats/metricbeat/7.x/metricbeat-module-mysql.html

- module: mysql
  metricsets:
    - status
    #- galera_status
    - performance
    - query
  period: 10s

  # Host DSN should be defined as "user:pass@tcp(127.0.0.1:3306)/"
  # or "unix(/var/lib/mysql/mysql.sock)/",
  # or another DSN format supported by <https://github.com/Go-SQL-Driver/MySQL/>.
  # The username and password can either be set in the DSN or using the username
  # and password config options. Those specified in the DSN take precedence.
  hosts: ["root:password@tcp(127.0.0.1:3306)/"]

  # Username of hosts. Empty by default.
  #username: root

  # Password of hosts. Empty by default.
  #password: secret

```

For the record, I'm using Metricbeat 7.12.1, with MySQL 5.7.33. So far I don't think there's anything iffy with the Elastic stack setup, because the same agent is also polling for metrics from MongoDB, Redis and RabbitMQ on the same machine. I believe the issue has been raised before too: [Exiting: 1 error: missing required field accessing '0.queries' (source:'/etc/metricbeat/modules.d/mysql.yml')](https://discuss.elastic.co/t/exiting-1-error-missing-required-field-accessing-0-queries-source-etc-metricbeat-modules-d-mysql-yml/250895). Would love some tips here - thanks a ton!

---

<div class="post-metadata">

**Author:** ![Marius\_Iversen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_iversen/32/68988_2.png) [@Marius\_Iversen](https://discuss.elastic.co/u/Marius_Iversen)\
**Post date:** [May 3, 2021, 10:11am UTC](https://discuss.elastic.co/t/metricbeat-for-mysql-fails-missing-required-field-accessing-0-queries/271895/2 "2021-05-03T10:11:25Z")

</div>

Hello @rudimk .

The reason you are seeing the error is that you have enabled the query metricset, but did not define the custom queries you wanted to run, if you don't want to run custom metrics queries you can disable that metricset.

I also noticed that the documentation does not mention this, so we have opened a PR to update the documentation, for a configuration example please see this new PR:

> <https://github.com/elastic/integrations/issues/964>
>
> Current docs at https://www.elastic.co/guide/en/beats/metricbeat/current/metricbeat-metricset-mysql-query.html don't show how the module is supposed to be configured, in particular users have a hard time...

---

<div class="post-metadata">

**Author:** ![rudimk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rudimk/32/88084_2.png) [@rudimk](https://discuss.elastic.co/u/rudimk)\
**Post date:** [May 3, 2021, 8:33pm UTC](https://discuss.elastic.co/t/metricbeat-for-mysql-fails-missing-required-field-accessing-0-queries/271895/3 "2021-05-03T20:33:31Z")

</div>

> [@Marius\_Iversen](#):
>
> Missing documentation for query metricset

Hi @Marius_Iversen! I disabled the `query` metricset and it ran just fine. Thanks ever so much! I suppose we can close this thread now 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 31, 2021, 10:33pm UTC](https://discuss.elastic.co/t/metricbeat-for-mysql-fails-missing-required-field-accessing-0-queries/271895/4 "2021-05-31T22:33:36Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
