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;