I installed MySQL 5.7.23 and set the character code in /etc/my.cnf with the following settings:
[mysqld]
character-set-server=utf8mb4
[client]
default-character-set=utf8mb4
The environment is Virtualbox (Host: win10 Guest: CentOS7).
I entered MySQL in teraterm and ran "show variables like '%char%';" to verify that the character code is correct.
character_set_client utf8mb4
character_set_connection utf8mb4
character_set_database utf8mb4
character_set_filesystem binary
character_set_results outf8mb4
character_set_server utf8mb4
character_set_system utf8
character_sets_dir/usr/share/mysql/charsets/
validate_password_special_char_count1
On the other hand, running the same command on MySQL Workbench will result in a different result.
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
character_sets_dir/usr/share/mysql/charsets/
validate_password_special_char_count1
Also, if you select a column containing emoticons on the workbench, it will be displayed as a character.
Run "SET NAMES utf8mb4;" at this time and it will be displayed successfully.
From the above, it seems that workbench uses local settings instead of servers, but my.cnf(my.ini) does not exist because there is no part of workbench that can set the character code and the host does not have mysql installed.
Do you know where and what settings workbench is loading?
mysql centos windows-10
https://dev.mysql.com/doc/workbench/en/wb-mysql-connections-new.html
^According to the above page, MySQL Workbench uses utf8 to connect without any questions or answers.
When opening connections, MySQL Workbench automatically sets the client character set to utf 8. Manually changing the client character set, Such as using SET NAMES..., may cause MySQL Workbench to not correctly display the characters. For additional information and contact set
So the answer is: MySQL Workbench probably uses the config to establish a connection for that connection because you haven't read my.cnf.
© 2024 OneMinuteCode. All rights reserved.