Name

mysql_kill( )

Synopsis

int mysql_kill(MYSQL *mysql, unsigned long identifier)

Use this to terminate a thread on the server. The thread identifier is passed as the second argument to the function. If you’re attempting to kill the current connection, you can use the mysql_thread_id( ) function with the session handle.

...
if(!mysql_kill(mysql, mysql_thread_id(mysql)))
   { printf("Terminated Current Thread. \n"); }
...

To kill a thread other than the current one, you can use the mysql_list_processes( ) function to list all threads to determine which one to terminate.

Get MySQL in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.