title: Characters appear as question marks in MySQL
body: <p>I have a problem saving unicode characters  in MySql. </p>
  
  <p>Initially my database character set was set to latin1 and unicode strings were  saves as quotation marks. After doing some research I added the following lines to <code>my.cnf</code>:</p>
  
  <pre><code>[mysqld]
  character-set-client-handshake = FALSE
  character-set-server = utf8mb4
  collation-server = utf8mb4_unicode_ci
  </code></pre>
  
  <p>and executed the query:</p>
  
  <pre><code>ALTER DATABASE &lt;my_database&gt; CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
  </code></pre>
  
  <p>After restarting mysql, I get an error:</p>
  
  <blockquote>
    <p>"org.springframework.jdbc.UncategorizedSQLException: Hibernate  operation: Could not execute JDBC batch   update; uncategorized SQLException for SQL ... Incorrect string value: '\xD0\xBA\xD1\x81\xD0\xB5...' for column 'first_name' at row 1"</p>
  </blockquote>
  
  <p>Query <code>mysql&gt; show variables like 'char%'</code>; returns the result:</p>
  
  <pre><code>Variable_name              | Value                      |
  +--------------------------+----------------------------+
  | character_set_client     | utf8mb4                    |
  | character_set_connection | utf8mb4                    |
  | character_set_database   | utf8mb4                    |
  | character_set_filesystem | binary                     |
  | character_set_results    | utf8mb4                    |
  | character_set_server     | utf8mb4                    |
  | character_set_system     | utf8                       |
  | character_sets_dir       | /usr/share/mysql/charsets/
  </code></pre>
  
  <p>and query <code>mysql&gt; show create database &lt;my_database&gt;</code> gives:</p>
  
  <pre><code>| Database  | Create Database                                                       |
  +-----------+-----------------------------------------------------------------------+
  | my_database | CREATE DATABASE `my_database` /*!40100 DEFAULT CHARACTER SET utf8mb4 */
  </code></pre>
  
  <p>I know this question was answered many time but I tried everything I found in google and still couldn't fix it. Any help is appreciated!</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>After querying SHOW CREATE TABLE, I saw that DEFAULT CHARSET of the table was latin1.</p>
  
  <p>I altered table with <code>ALTER TABLE my_table CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci</code>;</p>
  
  <p>After that each column had CHARACTER SET set to latin1, while DEFAULT CHARSET at the end of the query result was utf8mb4</p>
  
  <p>After altering the column with <code>ALTER TABLE my_table MODIFY my_column VARCHAR(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL</code>, I got rid of the error when saving the value, but it went back to saving the string with question marks. Still haven't found the problem</p>