diff -ur mysqlclient-1.3.10.orig/_mysql.c mysqlclient-1.3.10/_mysql.c
--- mysqlclient-1.3.10.orig/_mysql.c	2017-01-04 13:47:08.000000000 +0100
+++ mysqlclient-1.3.10/_mysql.c	2017-08-21 10:53:21.014929937 +0200
@@ -1060,7 +1060,7 @@
 	if (self && PyModule_Check((PyObject*)self))
 		self = NULL;
 	if (self && self->open) {
-#if MYSQL_VERSION_ID >= 50707 && !defined(MARIADB_BASE_VERSION)
+#if MYSQL_VERSION_ID >= 50707 && (!defined(MARIADB_BASE_VERSION) && !defined(MARIADB_VERSION_ID))
 		len = mysql_real_escape_string_quote(&(self->connection), out, in, size, '\'');
 #else
 		len = mysql_real_escape_string(&(self->connection), out, in, size);
@@ -1118,7 +1118,7 @@
 	out = PyBytes_AS_STRING(str);
 	check_server_init(NULL);
 	if (self && self->open) {
-#if MYSQL_VERSION_ID >= 50707 && !defined(MARIADB_BASE_VERSION)
+#if MYSQL_VERSION_ID >= 50707 && (!defined(MARIADB_BASE_VERSION) && !defined(MARIADB_VERSION_ID))
 		len = mysql_real_escape_string_quote(&(self->connection), out+1, in, size, '\'');
 #else
 		len = mysql_real_escape_string(&(self->connection), out+1, in, size);
diff -ur mysqlclient-1.3.10.orig/setup_posix.py mysqlclient-1.3.10/setup_posix.py
--- mysqlclient-1.3.10.orig/setup_posix.py	2016-07-26 10:12:24.000000000 +0200
+++ mysqlclient-1.3.10/setup_posix.py	2017-08-21 10:54:59.643071374 +0200
@@ -63,7 +63,7 @@
         if extra_compile_args[i] == '-arch':
             extra_link_args += ['-arch', extra_compile_args[i + 1]]
 
-    include_dirs = [dequote(i[2:])
+    include_dirs = [dequote(os.path.isdir(i[2:]+'/server') and i[2:]+'/server' or i[2:])
                     for i in mysql_config('include') if i.startswith('-I')]
 
     if static:
