Bug #107500 Contribution by Tentent: Setting default-character-set does not take effect
Submitted: 7 Jun 2022 11:20 Modified: 7 Jun 2022 11:28
Reporter: Steven Duan (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Charsets Severity:S2 (Serious)
Version:any, 8.0 OS:Any
Assigned to: CPU Architecture:Any
Tags: charset, Contribution

[7 Jun 2022 11:20] Steven Duan
Description:
The specified character set of the MySQL client (--default-character-set) does not take effect when it is the same as the default server character set (character_set_server).

How to repeat:
1) character_set_server=utf8 (in my.cnf)
2) mysql -u -p

set global collation_connection = latin1_general_ci;

quit;

3)mysql -u -p --default-character-set=utf8

mysql> show variables like 'character_set_connection';
+--------------------------+--------+
| Variable_name            | Value  |
+--------------------------+--------+
| character_set_connection | latin1 |
+--------------------------+--------+

latin1 (Should be set to utf8)

Suggested fix:
use client specified character set
[7 Jun 2022 11:21] Steven Duan
bugfix

(*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: bugfix-Setting-default-character-set-does-not-take-effect.patch (application/octet-stream, text), 1.62 KiB.

[7 Jun 2022 11:28] MySQL Verification Team
Hello duan hc,

Thank you for the report and contribution.

regards,
Umesh