0

How can I stop the slave if it is already running using sql query statements only?

So far I tried to do something like below but getting sql syntax error. I think it is due to the borders of result in conditional statement.

if ((select VARIABLE_VALUE from information_schema.GLOBAL_STATUS 
      where VARIABLE_NAME = 'slave_running')=ON) 
     then  
         STOP SLAVE; 
end if;

2 Answers 2

2

Why not simply do STOP SLAVE? If not "slave_running", it will have no effect.

0

It seems like I have done some mistake in syntax. Forgotten to use DELIMITER

DELIMITER //    
 IF ((select VARIABLE_VALUE from information_schema.GLOBAL_STATUS 
    where VARIABLE_NAME = 'slave_running')='ON') then STOP SLAVE; 
 END IF//    
DELIMITER ;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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