0

I connected mysql in linux server using mysql -u root -p dbnmae then i use cmd show processlist; and its showing result like

+---------+------+
| Id      | User |
+---------+------+
| 123     | root |
| 1234    | root |
| 1235    | root |
| 1236    | root |
| 1004    | root |
| 1205    | root |
| 1216    | root |

Now I want to kill some process_id (1234,1005,1205) using one command only. When I tried to kill in many ways but its not working properly. Its showing error like a

mysql> kill 1234 1005 1205;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1205' at line 1

Can you please help me to how to solve this issue. This is a DB2 server.

  • 2
    You say "DB2", but the program you use is `mysql` (which is most certainly *not* DB2). – RonJohn Apr 06 '23 at 14:39
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Apr 06 '23 at 14:51
  • Yes, I am using for DB2 only but its SQL server. I got the solution for my question. We need to use a command like this: `Select concat ('kill ', ID,';') from information_schema. Processlist where TIME >= 3000 AND TIME <= 5000 AND INFO like 'Select COUNT (*) %' INTO OUTFILE 'kills2.csv';` And then open the .CSV file and copy all commands from .CSV file and paste into it. It will delete all kill id which is coming from CSV file. – priyank Jul 26 '23 at 09:56

0 Answers0