title: Force MariaDB clients to use utf8mb4
body: <p>I'm running into an issue where I'm getting differently ordered results when querying with PHP Versus the command line. From my research, it appears that in some cases that bad encoding can cause problems with the order of the results.</p>
  
  <p>That said, all my DB tables are encoded as <code>utf8mb4</code>, with the collation <code>utf8mb4_general_ci</code>. However, it doesnt seem that the mysql variables are set correctly.</p>
  
  <p>I'm on Mysql 5.5.5-10.1.26-MariaDb.</p>
  
  <p>Here are my CNF settings, but to be honest I don't know what I'm doing here:</p>
  
  <pre><code>[client]
  default-character-set=utf8mb4
  
  [mysql]
  default-character-set=utf8mb4
  
  [mariadb]
  
  
  [mysqld]
  
  character-set-server=utf8mb4
  character_set_client=utf8mb4
  collation-server=utf8mb4_general_ci
  </code></pre>
  
  <p>The variables output from mysql:</p>
  
  <pre><code>character_set_client        utf8
  character_set_connection    utf8
  character_set_database      utf8mb4
  character_set_filesystem    binary
  character_set_results       utf8
  character_set_server        utf8mb4
  character_set_system        utf8
  collation_connection        utf8_general_ci
  collation_database          utf8mb4_unicode_ci
  collation_server            utf8mb4_general_ci
  </code></pre>
  
  <p>Update: A person has asked for how I'm connecting to the database:</p>
  
  <pre><code>$this-&gt;connection = new PDO('mysql:host='.DB_SERVER.';dbname='.DB_NAME.';port='.DB_PORT, DB_USER, DB_PASS, $options);
  </code></pre>
  
  <p>Update: I've switched to <code>utf8mb4_unicode_ci</code> (as per suggestions in answers below).</p>