mysql_kill()
int mysql_kill(MYSQL *mysql, unsigned long identifier)Use this function 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. Here is an example:
...
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.