mysql_kill(3)
π mysql_kill β bestie, we're ending this connection's whole career
okay so this is mysql_kill(3), straight out of the MariaDB Connector/C manual. yeah, manual section 3, the C library girlies. let's get into it π
β¨ NAME β¨
mysql_kill β kills a connection. that's it. that's the whole vibe. it's giving executioner but make it a function call π
πΈ SYNOPSIS πΈ
#include <mysql.h>
int mysql_kill(MYSQL * mysql,
unsigned long);
yes bestie, that second param is literally just unsigned long with no name. the manual said what it said, and we're keeping it exactly. no notes π«Ά
π¦ DESCRIPTION π¦
so basically you use this function to ask the server to kill a MariaDB thread, and you pick which thread with the processid parameter. key word: ask. the server does the actual yeeting π₯
and where do you get that processid from, you ask? you gotta retrieve it with SHOW PROCESSLIST. that's the plug. no cap.
but wait β if the thread you're trying to kill is your own connection? then you use mysql_thread_id(3) instead. don't be out here trying to kill yourself with the wrong function, that's embarrassing π
π PARAMETER π
mysqlβ a connection identifier, which was previously allocated bymysql_init(3)and connected bymysql_real_connect(3). returns0on success, otherwise nonzero.longβ process id. that's the one. the target. the chosen one β¨
π NOTES π
- if you just wanna stop a running command without killing the whole connection, use
KILL QUERYinstead. like, calm down, you don't have to end everything π - lowkey important:
mysql_kill()only kills a connection. it does not free any memory. none. zero. nada. you have to free that yourself, explicitly, by callingmysql_close(3). don't forget or the memory just sits there haunting you π
π RETURN VALUE π
returns zero on success, non zero on error. simple as that, fr fr.
π SEE ALSO π
ok that's the whole page bestie, go forth and kill connections responsibly π«Άβ¨
Version 3.4 of the MariaDB Connector/C manual, babes β that's the source and the version, and honestly? iconic. slay ππ
π¦ where this page comes from
- alpine 3.22: mariadb-doc 11.4.13-r0 Β· GPL-2.0-or-later
- alpine 3.23: mariadb-doc 11.4.13-r0 Β· GPL-2.0-or-later
- alpine 3.24: mariadb-doc 11.8.9-r0 Β· GPL-2.0-only
- arch rolling: mariadb 13.0.2-2 Β· GPL-2.0-only
- arch rolling: mariadb-lts 12.3.3-2 Β· GPL-2.0-only
- centos-stream 10: mariadb-connector-c-doc 3.4.4-2.el10 Β· LGPL-2.1-or-later
- debian trixie: libmariadb-dev 1:11.8.6-0+deb13u1 Β· GPL-2.0-only
- fedora 43: mariadb-connector-c-doc 3.4.5-2.fc43 Β· LGPL-2.1-or-later AND PHP-3.0 AND PHP-3.01
- fedora 43: mariadb-connector-c-doc 3.4.9-2.fc43 Β· LGPL-2.1-or-later AND PHP-3.0 AND PHP-3.01 AND LicenseRef-Fedora-Public-Domain
- fedora 44: mariadb-connector-c-doc 3.4.8-3.fc44 Β· LGPL-2.1-or-later AND PHP-3.0 AND PHP-3.01
- fedora 44: mariadb-connector-c-doc 3.4.9-2.fc44 Β· LGPL-2.1-or-later AND PHP-3.0 AND PHP-3.01 AND LicenseRef-Fedora-Public-Domain
- nixpkgs unstable: mariadb-server 11.8.8
- opensuse-leap 16.0: libmariadb-devel 3.4.9-160000.1.1 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: libmariadb-devel 3.4.9-160000.1.1 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: libmariadb-devel 3.4.9-160000.1.1 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: libmariadb-devel 3.4.9-160000.1.1 Β· LGPL-2.1-or-later
- ubuntu questing: libmariadb-dev 1:11.8.3-1build1
- ubuntu resolute: libmariadb-dev 1:11.8.6-5 Β· GPL-2.0-only
- ubuntu resolute: libmariadb-dev 1:11.8.6-5ubuntu0.1 Β· GPL-2.0-only
- ubuntu stonking: libmariadb-dev 1:11.8.9+ds-4ubuntu2 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms