Adding MySQL Service Monitoring

You add MySQL services (Metrics and Query Analytics) with the following command:


pmm-admin add mysql --query-source=slowlog --username=pmm --password=pmm

where username and password are credentials for the monitored MySQL access, which will be used locally on the database host. Additionally, two positional arguments can be appended to the command line flags: a service name to be used by PMM, and a service address. If not specified, they are substituted automatically as <node>-mysql and

The command line and the output of this command may look as follows:

pmm-admin add mysql --query-source=slowlog --username=pmm --password=pmm sl-mysql
MySQL Service added.
Service ID  : /service_id/a89191d4-7d75-44a9-b37f-a528e2c4550f
Service name: sl-mysql


There are two possible sources for query metrics provided by MySQL to get data for the Query Analytics: the slow log and the Performance Schema.

The --query-source option can be used to specify it, either as slowlog (it is also used by default if nothing specified) or as perfschema:

pmm-admin add mysql --username=pmm --password=pmm --query-source=perfschema ps-mysql

Beside positional arguments shown above you can specify service name and service address with the following flags: --service-name, --host (the hostname or IP address of the service), and --port (the port number of the service). If both flag and positional argument are present, flag gains higher priority. Here is the previous example modified to use these flags:

pmm-admin add mysql --username=pmm --password=pmm --service-name=ps-mysql --host= --port=3306


It is also possible to add MySQL instance using UNIX socket with use of a special --socket flag followed with the path to a socket without username, password and network type:

pmm-admin add mysql --socket=/var/path/to/mysql/socket

After adding the service you can view MySQL metrics or examine the added node on the new PMM Inventory Dashboard.

Edit this page: .md.rst

Table Of Contents

Previous topic

Configuring PMM Client with pmm-admin config

Next topic

Adding MongoDB Service Monitoring