I have a problem of mysql processes staying alive.
SHOW PROCESSLIST; returns a list of processes. There are processes existing for hours - according to process ID, host (port).
It seems like the process performs a query (SELECT) than sleeps, performs the query again - and it happens all over again. The "time" shown in PROCESSLIST keeps resetting after each sleep.
How to make Mysql automatically kill such processes? I suppose that such a process stays alive after a PHP script timeout (it also performs a CURL task).
[EDIT - to answer comments]
The query:
SELECT COUNT(*) FROM keywords WHERE updated < '2018-05-03 00:00:00' AND status = '0' AND active = '1;
columns: updated (DATETIME), status (INT) and active (BOOL) are INDEXED.
There is ~120K records in the table "keywords".
My PHP script is connecting to MySQL via PDO.
I have also set the following variables:
interactive_timeout = 180
wait_timeout = 180