MySQL Forums
Forum List  »  Newbie

Issue with client charset
Posted by: Yeoming Lee
Date: April 02, 2023 11:41PM

I am using mysql connector/c++ 8.0.17 in centos environment.
And the version of mysql server is 5.6.51 MySQL Community Server.

When creating a connection in the client,
"utf8mb4" was set in the "OPT_CHARSET_NAME" option.

However, the value of this option doesn't seem to be reflected.
This is because if you execute a query like SHOW VARIABLES LIKE 'character_set%', the result is as shown below.

character_set_client | utf8 |
character_set_connection | utf8 |
character_set_database | utf8 |
character_set_filesystem | binary |
character_set_results | utf8 |
character_set_server | utf8 |
character_set_system | utf8 |
character_sets_dir | /usr/share/mysql/charsets/ |==================================================

It comes out as utf8, not utf8mb4.
As a result, the value of the column with the utf8mb4 attribute cannot be read properly.

The question is, why is the "OPT_CHARSET_NAME" option in the client not reflected properly?

The current charset environment of Mysql server is as follows.

mysql> status
mysql Ver 14.14 Distrib 5.6.51, for Linux (x86_64) using EditLine wrapper

Connection id: 58
Current database: test_audit
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.6.51 MySQL Community Server (GPL)
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: utf8
Db characterset: utf8
Client characterset: utf8
Conn. characterset: utf8
UNIX socket: /var/lib/mysql/mysql.sock
Uptime: 3 hours 45 min 32 sec


Options: ReplyQuote

Written By
Issue with client charset
April 02, 2023 11:41PM

Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.