Endless Query Loop In Mysql I will delete millions records from a table in mysql dbms, but i don't want to delete all records at one time not to force database server cpu. That's why i want to use my query many times. My whille loops doesn't work.I don't know why. How to do that? My query is below:

while 1=1 DO
delete  FROM customer.generallogs  where DateEnter &lt; '2019-04-03 16:13:28' limit 100000;
end while;
SP can be like (draft code):

CREATE PROCEDURE DeleteFromGeneralLogs (IN DeleteTill DATETIME)
BEGIN
DECLARE done INT DEFAULT 0;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done:=1;
-- IF DeleteTill IS NULL THEN LEAVE;
WHILE done = 0 DO
    SELECT SLEEP(1) INTO done; -- small pause between chunks
    DELETE 
        FROM customer.generallogs  
        WHERE DateEnter &lt; DeleteTill  
        LIMIT 100000;
END WHILE;
END;


And then 

CALL DeleteFromGeneralLogs('2019-04-03 16:13:28');