ExpressionEngine 2 incompatibility with MySQL 5.7.x

ExpressionEngine 2 has issues with MySQL 5.7.x. When searching for existing entries the selct query doesn’t include the field used for DISTINCT. This not only hurts performance, but it is required for MySQL 5.7.x. There are essentially two solutions. Modifying the search model is the best solution, but that isn’t always possible. Alternatively, you can some change mysql server settings.

diff --git a/search_model.php.orig b/search_model.php
index d072392..216ac84 100644
--- a/search_model.php
+++ b/search_model.php
@@ -459,20 +459,24 @@ class Search_model extends CI_Model {
 				if ($key == 'channel_name')
 				{
 					$this->db->order_by('FIELD(channel_id, '.$channel_name_order.')', NULL, FALSE);
+					$this->db->select('channel_id');
 				}
 				elseif ($key == 'screen_name')
 				{
 					$this->db->order_by('FIELD(author_id, '.$screen_name_order.')', NULL, FALSE);
+					$this->db->select('author_id');
 				}
 				else
 				{
 					$this->db->order_by($key, $val);
+					$this->db->select($key);
 				}
 			}
 		}
 		else
 		{
 			$this->db->order_by('entry_date', 'desc');
+			$this->db->select('entry_date');
 		}

 		//$this->db->limit($data['perpage'], $data['rownum']);

Download patch