Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I wanted to capture only status/result of Slave_IO_Running and Slave_SQL_Running column values, which I will be using to integrate into our application.

Is there any way to get only the values of those fields instead of getting values of all fields of SHOW SLAVE STATUS.

My OS is windows.

I am using MySQL 5.0.24

share|improve this question
hey @Phanindra, are you running a more modern version of MySQL now? if yes, does Derek's answer still work? it doesn't for me in v.5.7.12 – knocte Jul 8 at 7:38
up vote 5 down vote accepted


mysql> SHOW STATUS LIKE 'Slave_running';
| Variable_name | Value |
| Slave_running | ON    |
1 row in set (0.04 sec)

From the manual:

This is ON if this server is a replication slave that is connected to a replication master, and both the I/O and SQL threads are running; otherwise, it is OFF.

Caveat: If you're running MySQL prior to version 5.1.46 or 5.5.4, it's possible the slave IO thread could not be running, and the status variable indicate the slave is running. (MySQL Bug 51089)

As of MySQL 5.7, the above solution will not work by default. This is because many of the status variables from information_schema are being moved into performance_schema:

As of MySQL 5.7.6, the Performance Schema also contains system and status variable tables (see Section 23.9.13, “Performance Schema System Variable Tables”, and Section 23.9.14, “Performance Schema Status Variable Tables”). The Performance Schema tables are intended to replace the INFORMATION_SCHEMA tables, which are deprecated as of MySQL 5.7.6 and will be removed in a future MySQL release. [src]


These Slave_xxx status variables become unavailable through SHOW STATUS:

  • Slave_heartbeat_period
  • Slave_last_heartbeat
  • Slave_received_heartbeats
  • Slave_retried_transactions
  • Slave_running

Applications that use these status variables should be revised to obtain this information using the replication-related Performance Schema tables.

There are two options to get the slave_running status outside of SHOW SLAVE STATUS

  1. The preferred method, as mentioned by the doc, is to update the application to pull from replication-connection-status.SERVICE_STATE and replication-applier-status.SERVICE_STATE in performance_schema:

// this is the SLAVE IO THREAD status
SELECT SERVICE_STATE FROM performance_schema.replication_connection_status;

// this is the SLAVE SQL THREAD status
SELECT SERVICE_STATE FROM performance_schema.replication_applier_status;

NOTE: This is for single master replication. Multi-master replication should be in replication_applier_coordinator.SERVICE_STATE

  1. The second option is to turn on show_compatibility_56. This is a temporary fix to get you by without modifying the application, but will go away in a future release.
share|improve this answer
I have experienced that dozens of times. The IO Thread does not really ping itself internally. It should. +1 for mentioning this IO Thread phenomenon. – RolandoMySQLDBA Sep 30 '11 at 16:54
this doesn't seem to work anymore? at least for Mysql v.5.7.12 – knocte Jul 8 at 7:37
@knocte I've updated for 5.7 information. – Derek Downey Jul 8 at 17:28
awesome thanks! – knocte Jul 8 at 17:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.