diff --git a/include/database/PearDatabase.php b/include/database/PearDatabase.php
index 6e7afbac7bd1f015045e66539963f53b7bd6b80a..10c4d5fab4a5cd48d828c98373e60be679b578e2 100644
--- a/include/database/PearDatabase.php
+++ b/include/database/PearDatabase.php
@@ -269,6 +269,9 @@ class PearDatabase{
 			$this->database->Execute($setnameSql);
 			$this->logSqlTiming($sql_start_time, microtime(true), $setnameSql);
 		}
+
+		// Ensure sql_mode is friendly
+		$this->database->Execute("SET SESSION sql_mode = 'NO_ENGINE_SUBSTITUTION'");
 	}
 
 	/**