How to get slave status into a stored procedure variable in MySQL version 8.0

Brad Jones
Brad Jones used Ask the Experts™
I'm trying to convert the following query that worked in MySQL 5.5 to MySQL 8.0. I am getting the following error: "Error Code: 1109. Unknown table 'GLOBAL_STATUS' in information_schema"

If this table no longer exists in version 8.0, is there another way to get the slave status?

drop procedure if exists aspDoCustDbCheck;;
CREATE  PROCEDURE `aspDoCustDbCheck`()
 declare vSlaveSts varchar(12);
 SELECT variable_value into vSlaveSts
 FROM information_schema.global_status 
 WHERE variable_name='SLAVE_RUNNING';
 Select vSlaveSts as SlaveSts
  ,Now() as Time
end ;;

call aspDoCustDbCheck();

Open in new window

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Distinguished Expert 2017

Do not have accessto 8, but why not simply run the query to see whether there is another variable/reference to reach the information?
Check whether the table global_status is actually in there.

In your situation, you have a base of information from which you are working for,

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial