diff -uNr dovecot-1.2.6.orig/src/lib-sql/driver-mysql.c dovecot-1.2.6/src/lib-sql/driver-mysql.c
--- dovecot-1.2.6.orig/src/lib-sql/driver-mysql.c	2009-09-07 01:17:12.000000000 +0100
+++ dovecot-1.2.6/src/lib-sql/driver-mysql.c	2009-11-19 09:40:36.000000000 +0000
@@ -134,7 +134,7 @@
 	alarm(MYSQL_CONNECT_FAILURE_TIMEOUT);
 	failed = mysql_real_connect(conn->mysql, host, db->user, db->password,
 				    db->dbname, db->port, unix_socket,
-				    db->client_flags) == NULL;
+				    db->client_flags | CLIENT_MULTI_STATEMENTS) == NULL;
 	alarm(0);
 	if (failed) {
 		if (conn->connect_failure_count > 0) {
@@ -429,6 +429,7 @@
 	struct mysql_db *db = (struct mysql_db *)_db;
 	struct mysql_connection *conn;
 	struct mysql_result *result;
+    MYSQL_RES *tmp_result;
 
 	result = i_new(struct mysql_result, 1);
 	result->api = driver_mysql_result;
@@ -442,6 +443,18 @@
 	case 1:
 		/* query ok */
 		result->result = mysql_store_result(conn->mysql);
+
+        /* mysql multistatements hack - fetch all remaining 
+           results and discard them */
+        while (mysql_next_result(conn->mysql) == 0) {
+            tmp_result = mysql_store_result(conn->mysql);
+            if (tmp_result) {
+                /* something's there.. just free it up */
+                mysql_free_result(tmp_result);
+            } 
+            /* silently ignoring non result stuff here... */
+        }
+
 		if (result->result != NULL || mysql_errno(conn->mysql) == 0)
 			break;
 		/* fallback */
