Skip to content

Commit

Permalink
Update mysql.md (#1294)
Browse files Browse the repository at this point in the history
* Update mysql.md

add tabs for better readability

* Update mysql.md

fix indentation
  • Loading branch information
igroene authored Aug 9, 2024
1 parent 0ff3702 commit 37bb821
Showing 1 changed file with 27 additions and 29 deletions.
56 changes: 27 additions & 29 deletions docs/setting-up/client/mysql.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,26 @@ Check that:

It is good practice to use a non-superuser account to connect PMM Client to the monitored database instance. This example creates a database user with name `pmm`, password `pass`, and the necessary permissions.

=== "MySQL 8.0"

**On MySQL 8.0**

```sql
CREATE USER 'pmm'@'127.0.0.1' IDENTIFIED BY 'pass' WITH MAX_USER_CONNECTIONS 10;
GRANT SELECT, PROCESS, REPLICATION CLIENT, RELOAD, BACKUP_ADMIN ON *.* TO 'pmm'@'127.0.0.1';
```

**On MySQL 5.7**
```sql
CREATE USER 'pmm'@'127.0.0.1' IDENTIFIED BY 'pass' WITH MAX_USER_CONNECTIONS 10;
GRANT SELECT, PROCESS, REPLICATION CLIENT, RELOAD, BACKUP_ADMIN ON *.* TO 'pmm'@'127.0.0.1';
```

```sql
CREATE USER 'pmm'@'127.0.0.1' IDENTIFIED BY 'pass' WITH MAX_USER_CONNECTIONS 10;
GRANT SELECT, PROCESS, REPLICATION CLIENT, RELOAD ON *.* TO 'pmm'@'127.0.0.1';
```
=== "MySQL 5.7"

**On MariaDB 10.5.8+**
```sql
CREATE USER 'pmm'@'127.0.0.1' IDENTIFIED BY 'pass' WITH MAX_USER_CONNECTIONS 10;
GRANT SELECT, PROCESS, REPLICATION CLIENT, RELOAD ON *.* TO 'pmm'@'127.0.0.1';
```

```sql
CREATE USER 'pmm'@'127.0.0.1' IDENTIFIED BY 'pass' WITH MAX_USER_CONNECTIONS 10;
GRANT SELECT, PROCESS, REPLICA MONITOR, RELOAD *.* TO 'pmm'@'127.0.0.1';
```
=== "MariaDB 10.5.8+"

```sql
CREATE USER 'pmm'@'127.0.0.1' IDENTIFIED BY 'pass' WITH MAX_USER_CONNECTIONS 10;
GRANT SELECT, PROCESS, REPLICA MONITOR, RELOAD *.* TO 'pmm'@'127.0.0.1';
```

## Choose and configure a source

Expand Down Expand Up @@ -77,7 +75,7 @@ Here are the benefits and drawbacks of *Slow query log* and *Performance Schema*

This section covers how to configure a MySQL-based database server to use the *slow query log* as a source of metrics.

### Applicable versions
#### Applicable versions

| Server | Versions |
|--------------------------|------------------|
Expand All @@ -88,7 +86,7 @@ This section covers how to configure a MySQL-based database server to use the *s

The *slow query log* records the details of queries that take more than a certain amount of time to complete. With the database server configured to write this information to a file rather than a table, PMM Client parses the file and sends aggregated data to PMM Server via the Query Analytics part of PMM Agent.

### Settings
#### Settings

| Variable | Value |Description
|-----------------------------------------------------------------|--------|----------------------------------------------------------
Expand All @@ -100,7 +98,7 @@ The *slow query log* records the details of queries that take more than a certai

#### Examples

- Configuration file.
=== "Configuration file"

```ini
slow_query_log=ON
Expand All @@ -110,7 +108,7 @@ The *slow query log* records the details of queries that take more than a certai
log_slow_slave_statements=ON
```

- Session.
=== "Session"

```sql
SET GLOBAL slow_query_log = 1;
Expand Down Expand Up @@ -144,7 +142,7 @@ Some MySQL-based database servers support extended slow query log variables.

##### Examples

- Configuration file (Percona Server for MySQL, Percona XtraDB Cluster).
=== "Configuration file (Percona Server for MySQL, Percona XtraDB Cluster)"

```ini
log_slow_rate_limit=100
Expand All @@ -154,13 +152,13 @@ Some MySQL-based database servers support extended slow query log variables.
slow_query_log_use_global_control='all'
```

- Configuration file (MariaDB).
=== "Configuration file (MariaDB)"

```ini
log_slow_rate_limit=100
```

- Session (Percona Server for MySQL, Percona XtraDB Cluster).
=== "Session (Percona Server for MySQL, Percona XtraDB Cluster)"

```sql
SET GLOBAL log_slow_rate_limit = 100;
Expand Down Expand Up @@ -217,7 +215,7 @@ To use *Performance Schema*, set the variables below.

#### Examples

- Configuration file.
=== "Configuration file"

```ini
performance_schema=ON
Expand All @@ -226,7 +224,7 @@ To use *Performance Schema*, set the variables below.
innodb_monitor_enable=all
```

- Session.
=== "Session"

(`performance_schema` cannot be set in a session and must be set at server start-up.)

Expand Down Expand Up @@ -336,21 +334,21 @@ User activity, individual table and index access details are shown on the [MySQL

### Examples

- Configuration file.
=== "Configuration file"

```ini
userstat=ON
```

- Session.
=== "Session"

```sql
SET GLOBAL userstat = ON;
```

## Add service

There are two ways to install PMM Client for monitoring your MySQL database:
There are two ways to install PMM Client for monitoring your MySQL database:

1. [Local installation](#Install-PMM-Client locally): Installs PMM Client directly on the database node, collecting both database and OS/host metrics. This option enables more effective comparison and problem identification.
2. [Remote instance](#Install-PMM-Client-as-a-remote-instance): Use when local installation isn't possible. This method doesn't provide OS/Node metrics in PMM.
Expand Down

0 comments on commit 37bb821

Please sign in to comment.