[MDEV-26107] Cannot set character_set variables in my.ini Created: 2021-07-07  Updated: 2023-10-04

Status: Open
Project: MariaDB Server
Component/s: Variables
Fix Version/s: N/A

Type: Task Priority: Major
Reporter: Olivier Bertrand Assignee: Sergei Golubchik
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-26105 MariaDB 10.6 cannot be used from C# c... Closed
relates to MDEV-26462 MariaDB 10.6.x set caratteri Closed

 Description   

According to the documentation, trying to set the variable character_set_results should done by something like:

[mysqld]
datadir=C:/Program Files/MariaDB 10.5/data
port=3306
default-storage-engine=MyISAM
skip-innodb
#innodb_buffer_pool_size=1010M
character-set-results=utf8mb4
[client]
port=3306
plugin-dir=C:/Program Files/MariaDB 10.5/lib/plugin

But trying to start the server fails:

C:\Program Files\MariaDB 10.5\bin>mariadbd --console
2021-07-07 17:24:40 0 [Note] mariadbd (mysqld 10.5.9-MariaDB) starting as process 1664 ...
2021-07-07 17:24:40 0 [Note] Plugin 'InnoDB' is disabled.
2021-07-07 17:24:40 0 [Note] Plugin 'FEEDBACK' is disabled.
2021-07-07 17:24:40 0 [Note] CONNECT: Version 1.07.0002 Feb 19 2021 10:36:16
2021-07-07 17:24:40 0 [ERROR] mariadbd: unknown variable 'character-set-results=utf8mb4'
2021-07-07 17:24:40 0 [ERROR] Aborting

This happens with all character set variables. Other variables can be set without problems.



 Comments   
Comment by Alice Sherepa [ 2021-07-08 ]

This is because character-set-results does not exist as a command-line or a config-file option, it is only a global/session variable. In the documentation, the absence of a command-line/config-file capability can be recognized by not having a line "Commandline" in the description, e.g. here ( https://mariadb.com/kb/en/server-system-variables/#character_set_results ), while the next one - character_set_server - has "Commandline: --character-set-server"

Comment by Olivier Bertrand [ 2021-07-08 ]

Well, I understand. However, it is needed for C# client applications (see MDEV-26105) so the fix is to make it a command-line or config-file option.

Comment by Sergei Golubchik [ 2021-07-08 ]

for mysql command line client it's the option --default-character=set that sets character_set_result.

For mysql-conector-net supposedly one can specify charset as a connection option, like "server=127.0.0.1;uid=root;pwd=12345;charset=utf8mb4".

Comment by Olivier Bertrand [ 2021-07-08 ]

Of course it is a client option. Trying to set --default-character-set when starting the server fails.

Specifying character set
Use this one to specify which character set to use to encode queries sent to the server.

Server=myServerAddress;Database=myDB;Uid=myUsername;Pwd=myPwd;CharSet=utf8;

Note that resultsets still are returned in the character set of the data returned.

Generated at Thu Feb 08 09:42:47 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.