mysql\_kill(3) MariaDB Connector/C mysql\_kill(3)

## [Name](#Name)

mysql\_kill - Kills a connection

## [Synopsis](#Synopsis)

```
#include <mysql.h>
int mysql_kill(MYSQL * mysql,


               unsigned long);
    
```

## [Description](#Description)

This function is used to ask the server to kill a MariaDB thread specified by the processid parameter. This value must be retrieved by \[show-processlist()](SHOW PROCESSLIST]]. If trying to kill the own connection [**mysql\_thread\_id(3)**](/man/os/mariadb-13.1/mysql_thread_id.3) should be used.

## [Parameter](#Parameter)

•

mysql - a connection identifier, which was previously allocated by [**mysql\_init(3)**](/man/os/mariadb-13.1/mysql_init.3) and connected by [**mysql\_real\_connect(3)**](/man/os/mariadb-13.1/mysql_real_connect.3). Returns 0 on success, otherwise nonzero.

•

long - process id

## [Notes](#Notes)

•

To stop a running command without killing the connection use KILL QUERY.

•

The mysql\_kill() function only kills a connection, it doesn’t free any memory - this must be done explicitly by calling [**mysql\_close(3)**](/man/os/mariadb-13.1/mysql_close.3).

## [Return value](#Return_value)

Returns zero on success, non zero on error.

## [See also](#See_also)

•

[**mysql\_thread\_id(3)**](/man/os/mariadb-13.1/mysql_thread_id.3)

•

[**mysql\_close(3)**](/man/os/mariadb-13.1/mysql_close.3)

•

[**mariadb\_cancel(3)**](/man/os/mariadb-13.1/mariadb_cancel.3)

Version 3.4

---

Document: mysql_kill(3) from mariadb-13.1 13.1.1-r1 (Chainguard OS)
