Mysql – Set character_set_results UTF8 in MySQL the.cnf

charsetMySQLutf-8

how can I set the Variable character_set_results from latin1 to uft8? I thought it would be enough to add the following variable in my.cnf:

default-character-set=utf8

But it not seem so:

mysql> SHOW VARIABLES LIKE 'character_set_%';
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | latin1                     |
| character_set_connection | latin1                     |
| character_set_database   | utf8                       |
| character_set_filesystem | binary                     |
| character_set_results    | latin1                     |
| character_set_server     | utf8                       |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+

Does anybody have an idea how I can set character_set_results to utf8?

Best Answer

The character set is negotiated between the client and the server on connect.

To prevent this and force the client and thus the server to use your configured character set:
[mysqld]
skip-character-set-client-handshake=1
default-character-set=utf8