title: COLLATION 'utf8_general_ci' is not valid for CHARACTER SET 'latin1'
body: <p>I am trying to fix a character encoding issue - previously we had the collation set for this column utf8_general_ci which caused issues because it is accent insensitive..</p>
  
  <p>I'm trying to find all the entries in the database that could have been affected.</p>
  
  <pre><code>set names utf8;
  select * from table1 t1 join table2 t2 on (t1.pid=t2.pid and t1.id != t2.id) collate utf8_general_ci;
  </code></pre>
  
  <p>However, this generates the error:</p>
  
  <pre><code>ERROR 1253 (42000): COLLATION 'utf8_general_ci' is not valid for CHARACTER SET 'latin1'
  </code></pre>
  
  <ol>
  <li>The database is now defined with <code>DEFAULT CHARACTER SET utf8</code></li>
  <li>The table  is defined with <code>CHARSET=utf8</code></li>
  <li>The "pid" column is defined with: <code>CHARACTER SET utf8 COLLATE utf8_bin NOT NULL</code></li>
  <li>The server version is Server version: 5.5.37-MariaDB-0ubuntu0.14.04.1 (Ubuntu)</li>
  </ol>
  
  <p>Question: Why am I getting an error about latin1 when latin1 doesn't seem to be present anywhere in the table / schema definition?</p>
  
  <pre><code>MariaDB [(none)]&gt; SHOW VARIABLES LIKE '%char%';
  +--------------------------+----------------------------+
  | Variable_name            | Value                      |
  +--------------------------+----------------------------+
  | character_set_client     | utf8                       |
  | character_set_connection | utf8                       |
  | character_set_database   | latin1                     |
  | character_set_filesystem | binary                     |
  | character_set_results    | utf8                       |
  | character_set_server     | latin1                     |
  | character_set_system     | utf8                       |
  | character_sets_dir       | /usr/share/mysql/charsets/ |
  +--------------------------+----------------------------+
  8 rows in set (0.00 sec)
  
  MariaDB [(none)]&gt; SHOW VARIABLES LIKE '%collation%';
  +----------------------+-------------------+
  | Variable_name        | Value             |
  +----------------------+-------------------+
  | collation_connection | utf8_general_ci   |
  | collation_database   | latin1_swedish_ci |
  | collation_server     | latin1_swedish_ci |
  +----------------------+-------------------+
  </code></pre>