# mariadb-report

`mariadb-report` makes a friendly report of important MariaDB status values.

Previously, the client was called `mysqlreport`. It can still be accessed under this name, via a symlink in Linux, or an alternate binary in Windows.

`mariadb-report` makes a report of nearly every status value from [SHOW STATUS](https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-status). Unlike `SHOW STATUS` , which simply dumps over 100 values to the screen in one long list, `mariadb-report` interprets and\
formats the values, and presents the basic values and many more inferred values in a human-readable format. Numerous example reports are available in this report: [hackmysql.com/mysqlreport](https://hackmysql.com/mysqlreport), [archived here](https://github.com/daniel-nichter/hackmysql.com/tree/master/mysqlreport).

The benefit of mariadb-report is that it allows you to very quickly see a wide array of performance indicators for your MariaDB server which would otherwise need to be calculated by hand from all the various `SHOW STATUS` values. For example, the Index Read Ratio is an important value but it's not present in `SHOW STATUS`; it's an inferred value (the ratio of `Key_reads` to `Key_read_requests`).

This documentation outlines all the command line options in `mariadb-report`, most of which control which reports are printed. This document does not address how to interpret these reports; that topic is covered in the document Guide To Understanding mysqlreport, [archived here](https://github.com/daniel-nichter/hackmysql.com/blob/master/mysqlreport/mysqlreportguide.html).

## Usage

```
mariadb-report [options]
```

## mariadb-report options

Technically, command line options are in the form `--option`, but `-option` works, too. All options can be abbreviated if the abbreviation is unique. For example, option `--host` can be abbreviated to `--ho` but not `--h` because `--h` is ambiguous: it could mean `--host` or `--help`.

| Option            | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| --all             | Equivalent to `--dtq --dms --com 3 --sas --qcache`. (Note that `--tab` is not invoked by `--all`.)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| --com N           | Print top N number of non-DMS Com\_ [status values](https://mariadb.com/docs/server/server-management/variables-and-modes/server-status-variables) in descending order (after DMS in Questions report). If N is not given, default is 3. Such non-DMS Com\_ values include [Com\_change\_db](https://mariadb.com/docs/server/server-management/variables-and-modes/server-status-variables#com_change_db), [Com\_show\_tables](https://mariadb.com/docs/server/server-management/variables-and-modes/server-status-variables#com_show_tables), [Com\_rollback](https://mariadb.com/docs/server/server-management/variables-and-modes/server-status-variables#com_rollback), etc.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| --dms             | Print Data Manipulation Statements (DMS) report (under DMS in Questions report). DMS are those from the [Data Manipulation](https://mariadb.com/docs/server/reference/sql-statements/data-manipulation) section. mariadb-report considers only [SELECT](https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/select), [INSERT](https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/inserting-loading-data/insert), [REPLACE](https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/changing-deleting-data/replace), [UPDATE](https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/changing-deleting-data/update), and [DELETE](https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/changing-deleting-data/delete). Each DMS is listed in descending order by count.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| --dtq             | Print Distribution of Total Queries (DTQ) report (under Total in Questions report). Queries (or Questions) can be divided into four main areas: `DMS` (see `--dms`), `Com_` (see `--com` ), `COM_QUIT` (see `COM_QUIT` and Questions, [archived here](https://github.com/daniel-nichter/hackmysql.com/blob/master/mysqlreport/mysqlreportguide.html)), and `Unknown`. `--dtq` lists the number of queries in each of these areas in descending order.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| --email *address* | After printing the report to screen, email the report to *address*. This option requires sendmail in `/usr/sbin/`, therefore it does not work on Windows. `/usr/sbin/sendmail` can be a symlink to qmail, or any MTA (mail transfer agent) that emulates sendmail's `-t` command line option and operation. The FROM: field is "mariadb-report", SUBJECT: is "MySQL status report".                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| --flush-status    | Execute a [FLUSH STATUS](https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/flush-commands/flush) after generating the reports. If you do not have permissions in MariaDB to do this an error from `DBD::mysql::st` is printed after the reports.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| --help            | Output help information and exit.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| --host ADDRESS    | Host address.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| --infile *file*   | Instead of getting [SHOW STATUS](https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-status) values from MariaDB, read values from *file*. *file* is often a copy of the output of `SHOW STATUS` including formatting characters (+, -). `mariadb-report` expects *file* to have the format "*value* number", where *value* is only alpha and underscore characters (A-Z and \_) and number is a positive integer. Anything before, between, or after value and number is ignored. mariadb-report also needs the following MariaDB server variables: [version](https://mariadb.com/docs/server/server-management/variables-and-modes/server-system-variables#version), [table\_cache](https://mariadb.com/docs/server/server-management/variables-and-modes/server-system-variables#table_open_cache), [max\_connections](https://mariadb.com/docs/server/server-management/variables-and-modes/server-system-variables#max_connections), [key\_buffer\_size](https://mariadb.com/docs/server/server-usage/storage-engines/myisam-storage-engine/myisam-system-variables#key_buffer_size), [query\_cache\_size](https://mariadb.com/docs/server/server-management/variables-and-modes/server-system-variables#query_cache_size). These values can be specified in `INFILE` in the format "name = value", where name is one of the aforementioned server variables and value is a positive integer with or without a trailing M and possible periods (for version). For example, to specify an 18M key\_buffer\_size, specify `key_buffer_size = 18M`. Or, for a 256 byte table\_cache, specify `table_cache = 256`. The M implies Megabytes, so 18M means 18,874,368. If these server variables are not specified, the following defaults are used (respectively) which may cause strange values to be reported: 0.0.0, 64, 100, 8M, 0. |
| --no-mycnf        | Makes `mariadb-report` not read `/.my.cnf` which it does by default otherwise. `--user` and `--password` always override values from `/.my.cnf`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| --outfile *file*  | After printing the report to screen, print the report to *file* too. Internally, `mariadb-report` always writes the report to a temporary file first: `/tmp/mysqlreport`.PID on \*nix, c:sqlreport. PID on Windows (PID is the script's process ID). Then it prints the temp file to screen. Then if --outfile is specified, the temp file is copied to `OUTFILE`. After `--email` (above), the temp file is deleted.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| --password        | `--password` can take the password on the command line, like `--password FOO`. Using `--password` without an argument causes `mariadb-report` to prompt for a password.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| --port *port*     | Port number.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| --qcache          | Print [Query Cache](https://mariadb.com/docs/server/ha-and-performance/optimization-and-tuning/buffers-caches-and-threads/query-cache) report.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| --sas             | Print report for Select\_ and Sort\_ [status values](https://mariadb.com/docs/server/server-management/variables-and-modes/server-status-variables) (after Questions report). See MySQL Select and Sort Status Variables, archived [here](https://github.com/daniel-nichter/hackmysql.com/blob/master/mysqlreport/mysqlreportguide.html).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| --socket *socket* | For connections to localhost, the Unix socket file to use, or, on Windows, the name of the named pipe to use.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| --tab             | Print Threads, Aborted, and Bytes status reports (after Created temp report). The Threads report reports on all Threads\_ status values.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| --user *username* | Username.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |

<sub>*This page is licensed: CC BY-SA / Gnu FDL*</sub>

{% @marketo/form formId="4316" %}
