kill()

Overview

Asks the server to kill a database connection based on its thread ID.

See also: MariaDB Connector/Python 1.1 and in 1.0

EXAMPLES

The following will kill all processes except the current connection (which is not usually a good idea):

import mariadb

conn = mariadb.connect(
    host = 'localhost',
    user = 'root',
    password = 'secret',
    database = 'test',
    )

cursor = conn.cursor()

cursor.execute("SHOW PROCESSLIST")
for row in cursor:
    tid = row[0]
    if tid != conn.connection_id:
        conn.kill(tid)

CHANGE HISTORY

Release Series

History

1.1

  • Present starting in MariaDB Connector/Python 1.1.0rc1.

1.0

  • Present starting in MariaDB Connector/Python 1.0.0.