Syntax
------

SHOW SLAVE ["connection_name"] STATUS [FOR CHANNEL "connection_name"]
SHOW REPLICA ["connection_name"] STATUS -- From MariaDB 10.5.1

or

SHOW ALL SLAVES STATUS
SHOW ALL REPLICAS STATUS -- From MariaDB 10.5.1

Description
-----------

This statement is to be run on a replica and provides status information on
essential parameters of the replica threads.

This statement requires the SUPER privilege, the REPLICATION_CLIENT privilege,
or, from MariaDB 10.5.2, the REPLICATION SLAVE ADMIN privilege, or, from
MariaDB 10.5.9, the REPLICA MONITOR privilege.

Multi-Source
------------

The ALL and "connection_name" options allow you to connect to many primaries
at the same time.

ALL SLAVES (or ALL REPLICAS from MariaDB 10.5.1) gives you a list of all
connections to the primary nodes.

The rows will be sorted according to Connection_name.

If you specify a connection_name, you only get the information about that
connection. If connection_name is not used, then the name set by
default_master_connection is used. If the connection name doesn't exist you
will get an error: There is no master connection for 'xxx'.

MariaDB starting with 10.7.0
----------------------------
The FOR CHANNEL keyword was added for MySQL compatibility. This is identical
to using the channel_name directly after SHOW SLAVE.

Column Descriptions
-------------------

The order in which the columns appear depends on the MariaDB version. This
means that extracting a column value is best done by comparing the field name
instead of using a fixed offset into the row.

+---------------------+------------------------------------------------------+
| Name                | Description                                          |
+---------------------+------------------------------------------------------+
| Connection_name     | Name of the primary connection. Returned with SHOW   |
|                     | ALL SLAVES STATUS (or SHOW ALL REPLICAS STATUS from  |
|                     | MariaDB 10.5.1) only.                                |
+---------------------+------------------------------------------------------+
| Slave_SQL_State     | State of SQL thread. Returned with SHOW ALL SLAVES   |
|                     | STATUS (or SHOW ALL REPLICAS STATUS from MariaDB     |
|                     | 10.5.1) only. See Slave SQL Thread States.           |
+---------------------+------------------------------------------------------+
| Slave_IO_State      | State of I/O thread. See Slave I/O Thread States.    |
+---------------------+------------------------------------------------------+
| Master_host         | Master host that the replica is connected to.        |
+---------------------+------------------------------------------------------+
| Master_user         | Account user name being used to connect to the       |
|                     | primary.                                             |
+---------------------+------------------------------------------------------+
| Master_port         | The port being used to connect to the primary.       |
+---------------------+------------------------------------------------------+
| Connect_Retry       | Time in seconds between retries to connect. The      |
|                     | default is 60. The CHANGE MASTER TO statement can    |
|                     | set this. The master-retry-count option determines   |
|                     | the maximum number of reconnection attempts.         |
+---------------------+------------------------------------------------------+
| Master_Log_File     | Name of the primary binary log file that the I/O     |
|                     | thread is currently reading from.                    |
+---------------------+------------------------------------------------------+
| Read_Master_Log_Pos | Position up to which the I/O thread has read in the  |
|                     | current primary binary log file.                     |
+---------------------+------------------------------------------------------+
| Relay_Log_File      | Name of the relay log file that the SQL thread is    |
|                     | currently processing.                                |
+---------------------+------------------------------------------------------+
| Relay_Log_Pos       | Position up to which the SQL thread has finished     |
|                     | processing in the current relay log file.            |
+---------------------+------------------------------------------------------+
| Relay_Master_Log_Fi | Name of the primary binary log file that contains    |
| e                   | the most recent event executed by the SQL thread.    |
+---------------------+------------------------------------------------------+
| Slave_IO_Running    | Whether the replica I/O thread is running and        |
|                     | connected (Yes), running but not connected to a      |
|                     | primary (Connecting) or not running (No).            |
+---------------------+------------------------------------------------------+
| Slave_SQL_Running   | Whether or not the SQL thread is running.            |
+---------------------+------------------------------------------------------+
| Replicate_Rewrite_D | Databases specified for replicating  and rewriting   |
|                     | with the replicate_rewrite_db option. Added in       |
|                     | MariaDB 10.11                                        |
+---------------------+------------------------------------------------------+
| Replicate_Do_DB     | Databases specified for replicating with the         |
|                     | replicate_do_db option.                              |
+---------------------+------------------------------------------------------+
| Replicate_Ignore_DB | Databases specified for ignoring with the            |
|                     | replicate_ignore_db option.                          |
+---------------------+------------------------------------------------------+
| Replicate_Do_Table  | Tables specified for replicating with the            |
|                     | replicate_do_table option.                           |
+---------------------+------------------------------------------------------+
| Replicate_Ignore_Ta | Tables specified for ignoring with the               |
| le                  | replicate_ignore_table option.                       |
+---------------------+------------------------------------------------------+
| Replicate_Wild_Do_T | Tables specified for replicating with the            |
| ble                 | replicate_wild_do_table option.                      |
+---------------------+------------------------------------------------------+
| Replicate_Wild_Igno | Tables specified for ignoring with the               |
| e_Table             | replicate_wild_ignore_table option.                  |
+---------------------+------------------------------------------------------+
| Last_Errno          | Alias for Last_SQL_Errno (see below)                 |
+---------------------+------------------------------------------------------+
| Last Error          | Alias for Last_SQL_Error (see below)                 |
+---------------------+------------------------------------------------------+
| Skip_Counter        | Number of events that a replica skips from the       |
|                     | master, as recorded in the sql_slave_skip_counter    |
|                     | system variable.                                     |
+---------------------+------------------------------------------------------+
| Exec_Master_Log_Pos | Position up to which the SQL thread has processed    |
|                     | in the current master binary log file. Can be used   |
|                     | to start a new replica from a current replica with   |
|                     | the CHANGE MASTER TO ... MASTER_LOG_POS option.      |
+---------------------+------------------------------------------------------+
| Relay_Log_Space     | Total size of all relay log files combined.          |
+---------------------+------------------------------------------------------+
| Until_Condition     |                                                      |
+---------------------+------------------------------------------------------+
| Until_Log_File      | The MASTER_LOG_FILE value of the START SLAVE UNTIL   |
|                     | condition.                                           |
+---------------------+------------------------------------------------------+
| Until_Log_Pos       | The MASTER_LOG_POS value of the START SLAVE UNTIL    |
|                     | condition.                                           |
+---------------------+------------------------------------------------------+
| Master_SSL_Allowed  | Whether an SSL connection is permitted (Yes), not    |
|                     | permitted (No) or permitted but without the replica  |
|                     | having SSL support enabled (Ignored)                 |
+---------------------+------------------------------------------------------+
| Master_SSL_CA_File  | The MASTER_SSL_CA option of the CHANGE MASTER TO     |
|                     | statement.                                           |
+---------------------+------------------------------------------------------+
| Master_SSL_CA_Path  | The MASTER_SSL_CAPATH option of the CHANGE MASTER    |
|                     | TO statement.                                        |
+---------------------+------------------------------------------------------+
| Master_SSL_Cert     | The MASTER_SSL_CERT option of the CHANGE MASTER TO   |
|                     | statement.                                           |
+---------------------+------------------------------------------------------+
| Master_SSL_Cipher   | The MASTER_SSL_CIPHER option of the CHANGE MASTER    |
|                     | TO statement.                                        |
+---------------------+------------------------------------------------------+
| Master_SSL_Key      | The MASTER_SSL_KEY option of the CHANGE MASTER TO    |
|                     | statement.                                           |
+---------------------+------------------------------------------------------+
| Seconds_Behind_Mast | Difference between the timestamp logged on the       |
| r                   | master for the event that the replica is currently   |
|                     | processing, and the current timestamp on the         |
|                     | replica. Zero if the replica is not currently        |
|                     | processing an event. With serial replication,        |
|                     | seconds_behind_master is updated when the SQL        |
|                     | thread begins executing a transaction. With          |
|                     | parallel replication, seconds_behind_master is       |
|                     | updated only after transactions commit. Starting in  |
|                     | MariaDB 10.3.38, 10.4.28, 10.5.19, 10.6.12, 10.8.7,  |
|                     | 10.9.5, 10.10.3, and 10.11.2, an exception is drawn  |
|                     | on the parallel replica to additionally update       |
|                     | seconds_behind_master when the first transaction     |
|                     | received after idling is queued to a worker for      |
|                     | execution, to provide a reliable initial value for   |
|                     | the duration until a transaction commits.            |
|                     | Additional behaviors to be aware of are as follows:  |
|                     | 1) Seconds_Behind_Master will update for ignored     |
|                     | events, e.g. those skipped due to                    |
|                     | sql_slave_skip_counter. 2) On the serial replica,    |
|                     | transactions with prior timestamps can update        |
|                     | Seconds_Behind_Master such that it can go            |
|                     | backwards, though this is not true for the parallel  |
|                     | replica. 3) When configured with MASTER_DELAY, as a  |
|                     | replicated transaction begins executing (i.e. on a   |
|                     | serial or post-idle parallel replica),               |
|                     | Seconds_Behind_Master will update before delaying,   |
|                     | and while delaying occurs will grow to encompass     |
|                     | the configured value. 4) There is a known issue,     |
|                     | tracked by MDEV-17516, such that                     |
|                     | Seconds_Behind_Master will initially present as 0    |
|                     | on replica restart until a replicated transaction    |
|                     | begins executing, even if the last replica session   |
|                     | was lagging behind when stopped.                     |
+---------------------+------------------------------------------------------+
| Master_SSL_Verify_S | The MASTER_SSL_VERIFY_SERVER_CERT option of the      |
| rver_Cert           | CHANGE MASTER TO statement.                          |
+---------------------+------------------------------------------------------+
| Last_IO_Errno       | Error code of the most recent error that caused the  |
|                     | I/O thread to stop (also recorded in the replica's   |
|                     | error log). 0 means no error. RESET SLAVE or RESET   |
|                     | MASTER will reset this value.                        |
+---------------------+------------------------------------------------------+
| Last_IO_Error       | Error message of the most recent error that caused   |
|                     | the I/O thread to stop (also recorded in the         |
|                     | replica's error log). An empty string means no       |
|                     | error. RESET SLAVE or RESET MASTER will reset this   |
|                     | value.                                               |
+---------------------+------------------------------------------------------+
| Last_SQL_Errno      | Error code of the most recent error that caused the  |
|                     | SQL thread to stop (also recorded in the replica's   |
|                     | error log). 0 means no error. RESET SLAVE or RESET   |