Skip to content

mysqlclient fails to build for MySQL >= 8.3.0 #688

Description

@etripier

Hi! I love your driver. It's fast and reliable.

Unfortunately, the MySQL team finally killed a couple of the APIs they've been threatening to remove for a while now - mysql_kill, mysql_shutdown, and mysql_ssl_set.

I fixed the issue here: etripier@ee1882e. I'd be more than happy to submit a PR to your repo.

diff --git a/src/MySQLdb/_mysql.c b/src/MySQLdb/_mysql.c
index 0612be2..4282ab3 100644
--- a/src/MySQLdb/_mysql.c
+++ b/src/MySQLdb/_mysql.c
@@ -524,7 +524,11 @@ _mysql_ConnectionObject_Initialize(
         mysql_options(&(self->connection), MYSQL_OPT_LOCAL_INFILE, (char *) &local_infile);

     if (ssl) {
-        mysql_ssl_set(&(self->connection), key, cert, ca, capath, cipher);
+        mysql_options(&(self->connection), MYSQL_OPT_SSL_KEY, key);
+        mysql_options(&(self->connection), MYSQL_OPT_SSL_CERT, cert);
+        mysql_options(&(self->connection), MYSQL_OPT_SSL_CA, ca);
+        mysql_options(&(self->connection), MYSQL_OPT_SSL_CAPATH, capath);
+        mysql_options(&(self->connection), MYSQL_OPT_SSL_CIPHER, cipher);
     }
     if (ssl_mode) {
 #ifdef HAVE_ENUM_MYSQL_OPT_SSL_MODE
@@ -1789,10 +1793,11 @@ _mysql_ConnectionObject_kill(
 {
     unsigned long pid;
     int r;
+    char query[50];
     if (!PyArg_ParseTuple(args, "k:kill", &pid)) return NULL;
     check_connection(self);
     Py_BEGIN_ALLOW_THREADS
-    r = mysql_kill(&(self->connection), pid);
+    r = mysql_query(&(self->connection), snprintf(query, 50, "KILL %d", pid));
     Py_END_ALLOW_THREADS
     if (r) return _mysql_Exception(self);
     Py_RETURN_NONE;
@@ -2008,7 +2013,7 @@ _mysql_ConnectionObject_shutdown(
     int r;
     check_connection(self);
     Py_BEGIN_ALLOW_THREADS
-    r = mysql_shutdown(&(self->connection), SHUTDOWN_DEFAULT);
+    r = mysql_query(&(self->connection), "SHUTDOWN");
     Py_END_ALLOW_THREADS
     if (r) return _mysql_Exception(self);
     Py_RETURN_NONE;

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions