• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Question Wordpress, MariaDB 10.1 and utf8 charset and collation

Giorgio1

New Pleskian
I upgraded to MariaDB 10.1 (CentOS 7.4, Plesk Onyx 17.5.3) following this tutorial and I would like to know if these settings in my.cnf file are ok (on my server there are websites in italian, english and polish languages).

I set these values in my.cnf:

Code:
[mysqld]
character-set-server = utf8
collation-server = utf8_general_ci
skip-character-set-client-handshake

restarted the service of mariadb and now with the command:

Code:
MariaDB [psa]> show variables like 'char%'; show variables like 'collation%';

I have:

Code:
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| 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/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)

+----------------------+-----------------+
| Variable_name        | Value           |
+----------------------+-----------------+
| collation_connection | utf8_general_ci |
| collation_database   | utf8_general_ci |
| collation_server     | utf8_general_ci |
+----------------------+-----------------+
3 rows in set (0.00 sec)

Before I had:

Code:
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8                       |
| character_set_connection | utf8                       |
| character_set_database   | utf8                       |
| character_set_filesystem | binary                     |
| character_set_results    | utf8                       |
| character_set_server     | latin1                     |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)

+----------------------+-------------------+
| Variable_name        | Value             |
+----------------------+-------------------+
| collation_connection | utf8_general_ci   |
| collation_database   | utf8_general_ci   |
| collation_server     | latin1_swedish_ci |
+----------------------+-------------------+

Are these new settings ok? Is it safe to change them after some days (I mean after some days of Wordpress websites running with the previous configuration of mariadb)?

Thanks for any suggestion.
 
No, it is not safe to change the values. Because these are your defaults and some software will rely on the defaults, for example will save data to a dataset in one character format. When you make changes later and save data to additional sets, the contents of your datasets can have different character sets. The same applies to reading. It cannot be predicted which applications might cause these issues, because it is not necessarily a problem, but if applications rely on defaults, they might not work correctly when the default character sets are changed after some while of operation.
 
Agree with Peter, but on the flipside - He just went utf8 to latin1, what happens to the existing applications if they are relying on the previous default?
 
Mmm.. I went from latin1_swedish_ci to utf8_general_ci and from latin1 to utf8 thinking is good for Wordpress...

So it should be better to remove these settings from my.cnf as soon as possible?
 
Last edited:
Back
Top