> ## Documentation Index
> Fetch the complete documentation index at: /documents/llms.txt
> Use this file to discover all available pages before exploring further.

# KILL

> Terminates a connection or a query currently being performed by threads executing within the database.

Terminates a connection or a query currently being performed by threads executing within the database.

**Tip**

This operation does not require privileges.

## Syntax

```SQL theme={null}
KILL [ CONNECTION | QUERY ] { <processlist_id> | <query_id> }
```

## Parameters

| **Parameter** | **Description** |
| - | - |
| Modifier:<ul><li>CONNECTION</li><li>QUERY</li></ul> | <ul><li>With a `CONNECTION` modifier, the KILL statement terminates the connection associated with the given `processlist_id`, after terminating any statement the connection is executing.</li><li>With a `QUERY` modifier, the KILL statement terminates the statement the connection is currently executing, but leaves the connection itself intact.</li><li>If no modifier is present, the default is `CONNECTION`.</li></ul> |
| processlist\_id | The ID of the thread you want to terminate. You can get the IDs of the threads that are being executed using [SHOW PROCESSLIST](/documents/4.2/sql-reference/sql-statements/cluster-management/nodes_processes/SHOW_PROCESSLIST.md). |
| query\_id | The ID of the query you want to terminate. You can get the IDs of the queries that are pending or being executed using SHOW RUNNING QUERIES or [SHOW PROC](/documents/4.2/sql-reference/sql-statements/cluster-management/nodes_processes/SHOW_PROC.md) with `'/current_queries'` and `'/global_current_queries'`. |

## Examples

```Plain theme={null}
mysql> SHOW FULL PROCESSLIST;
+------+------+---------------------+--------+---------+---------------------+------+-------+-----------------------+-----------+
| Id   | User | Host                | Db     | Command | ConnectionStartTime | Time | State | Info                  | IsPending |
+------+------+---------------------+--------+---------+---------------------+------+-------+-----------------------+-----------+
|   20 | root | xxx.xx.xxx.xx:xxxxx | sr_hub | Query   | 2023-01-05 16:30:19 |    0 | OK    | show full processlist | false     |
+------+------+---------------------+--------+---------+---------------------+------+-------+-----------------------+-----------+
1 row in set (0.01 sec)

mysql> KILL 20;
Query OK, 0 rows affected (0.00 sec)
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.