0

I've been following this tutorial on how to setup a MySQL server/database for unicode, with the hopes of setting up the default character set to utf8mb4, and the collation to utf8mb4_unicode_ci

Just like what is specified in the tutorial, I have the following settings applied in my .ini file, located at C:\ProgramData\MySQL\MySQL Server 5.7 :

    [client]
    default-character-set = utf8mb4

    [mysql]
    default-character-set = utf8mb4

    [mysqld]
    character-set-client-handshake = FALSE
    character-set-server = utf8mb4
    collation-server = utf8mb4_unicode_ci

When running this query in MySql Workbench:

SHOW VARIABLES WHERE Variable_name LIKE 'character\_set\_%' OR Variable_name LIKE 'collation%'

It has not been showing the system variables that I would expect, so initially I thought I had misconfigured the server:

MySql Workbench output

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_unicode_ci

However, when using the native MySQL command line client, I'm seeing what I would expect:

+--------------------------+--------------------+
| 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               |
| collation_connection     | utf8mb4_unicode_ci |
| collation_database       | utf8mb4_unicode_ci |
| collation_server         | utf8mb4_unicode_ci |
+--------------------------+--------------------+

Why would MySql Workbench not respect the configuration settings, like the command line client does?

MySql: Windows/5.7.21
MySql Workbench: Windows/6.3.10

contactmatt
  • 18,116
  • 40
  • 128
  • 186

1 Answers1

1
  1. MySQL Workbench doesn't read the ini file and hence doesn't use any of the values in it. How can it, given that it can connect to many servers at the same time?

  2. MySQL Workbench uses a fixed encoding for client and connection character sets (utf-8).

  3. Until version 8.0.11 RC MySQL Workbench used the utf8mb3 charset actually. Starting with that version it switched to utf8mb4.

Mike Lischke
  • 48,925
  • 16
  • 119
  • 181