diff --git a/lib/private/db/adaptermysql.php b/lib/private/db/adaptermysql.php
new file mode 100644
index 0000000000000000000000000000000000000000..0b6e6a5e96971158cd9de69992d6b31323c5df53
--- /dev/null
+++ b/lib/private/db/adaptermysql.php
@@ -0,0 +1,17 @@
+<?php
+/**
+ * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+
+namespace OC\DB;
+
+class AdapterMySQL extends Adapter {
+	public function fixupStatement($statement) {
+		$statement = str_replace(' ILIKE ', ' COLLATE utf8_general_ci LIKE ', $statement);
+		return $statement;
+	}
+}
diff --git a/lib/private/db/adapteroci8.php b/lib/private/db/adapteroci8.php
index bc226e979eceae7a4a9463a7e6eb9029b44e71d0..fb4ea1bcde92692ee70aee6bb9cfe0b9d477b6f9 100644
--- a/lib/private/db/adapteroci8.php
+++ b/lib/private/db/adapteroci8.php
@@ -11,18 +11,20 @@ namespace OC\DB;
 
 class AdapterOCI8 extends Adapter {
 	public function lastInsertId($table) {
-		if($table !== null) {
+		if ($table !== null) {
 			$suffix = '_SEQ';
-			$table = '"'.$table.$suffix.'"';
+			$table = '"' . $table . $suffix . '"';
 		}
 		return $this->conn->realLastInsertId($table);
 	}
 
 	const UNIX_TIMESTAMP_REPLACEMENT = "(cast(sys_extract_utc(systimestamp) as date) - date'1970-01-01') * 86400";
+
 	public function fixupStatement($statement) {
-		$statement = str_replace( '`', '"', $statement );
-		$statement = str_ireplace( 'NOW()', 'CURRENT_TIMESTAMP', $statement );
-		$statement = str_ireplace( 'UNIX_TIMESTAMP()', self::UNIX_TIMESTAMP_REPLACEMENT, $statement );
+		$statement = preg_replace('/`(\w+)` ILIKE \?/', 'REGEXP_LIKE(`$1`, TRIM(BOTH \'%\' FROM ?), \'i\')', $statement);
+		$statement = str_replace('`', '"', $statement);
+		$statement = str_ireplace('NOW()', 'CURRENT_TIMESTAMP', $statement);
+		$statement = str_ireplace('UNIX_TIMESTAMP()', self::UNIX_TIMESTAMP_REPLACEMENT, $statement);
 		return $statement;
 	}
 }
diff --git a/lib/private/db/adaptersqlite.php b/lib/private/db/adaptersqlite.php
index 5b9c5a437da98152212ed17b7ecd9033f5f061ee..06cdb7aab054319b7165fb4d5cc74c57f2dad3ac 100644
--- a/lib/private/db/adaptersqlite.php
+++ b/lib/private/db/adaptersqlite.php
@@ -11,6 +11,7 @@ namespace OC\DB;
 
 class AdapterSqlite extends Adapter {
 	public function fixupStatement($statement) {
+		$statement = str_replace(' ILIKE ', ' LIKE ', $statement);
 		$statement = str_replace( '`', '"', $statement );
 		$statement = str_ireplace( 'NOW()', 'datetime(\'now\')', $statement );
 		$statement = str_ireplace( 'UNIX_TIMESTAMP()', 'strftime(\'%s\',\'now\')', $statement );
diff --git a/lib/private/db/connectionfactory.php b/lib/private/db/connectionfactory.php
index dbbe58dbef899610919b06bf985314d3d916915c..8fd26bdc947c95dc2c9b367be1414f0afb2e0cb1 100644
--- a/lib/private/db/connectionfactory.php
+++ b/lib/private/db/connectionfactory.php
@@ -26,7 +26,7 @@ class ConnectionFactory {
 			'wrapperClass' => 'OC\DB\Connection',
 		),
 		'mysql' => array(
-			'adapter' => '\OC\DB\Adapter',
+			'adapter' => '\OC\DB\AdapterMySQL',
 			'charset' => 'UTF8',
 			'driver' => 'pdo_mysql',
 			'wrapperClass' => 'OC\DB\Connection',
diff --git a/tests/lib/db.php b/tests/lib/db.php
index 1f62413cbe42164f11acd445eb0ca6fcfdb9bdb1..893d42cdbe962ad9c6c7ff30273bf38de8681eae 100644
--- a/tests/lib/db.php
+++ b/tests/lib/db.php
@@ -263,4 +263,19 @@ class Test_DB extends PHPUnit_Framework_TestCase {
 		$query = OC_DB::prepare("UPDATE `*PREFIX*{$this->table2}` SET `uri` = ? WHERE `fullname` = ?");
 		return $query->execute(array($uri, $fullname));
 	}
+
+	public function testILIKE() {
+		$table = "*PREFIX*{$this->table2}";
+
+		$query = OC_DB::prepare("INSERT INTO `$table` (`fullname`, `uri`, `carddata`) VALUES (?, ?, ?)");
+		$query->execute(array('fooBAR', 'foo', 'bar'));
+
+		$query = OC_DB::prepare("SELECT * FROM `$table` WHERE `fullname` LIKE ?");
+		$result = $query->execute(array('foobar'));
+		$this->assertCount(0, $result->fetchAll());
+
+		$query = OC_DB::prepare("SELECT * FROM `$table` WHERE `fullname` ILIKE ?");
+		$result = $query->execute(array('foobar'));
+		$this->assertCount(1, $result->fetchAll());
+	}
 }