MariaDB: Problems with UTF-8 characters after migrating to a new server

MariaDB: Problems with UTF-8 characters after migrating to a new server

I have migrated to another server many times but never had this problem. None of the possible solutions work and utf-8 characters appear incorrectly in PHP-FPM.

What I tried:

ALTER DATABASE database2 CHARACTER SET utf8;

Edited my.conf file and added lines:

[mysqld]
collation-server = utf8_unicode_ci
init-connect='SET NAMES utf8'
character-set-server = utf8

Tried to change charsets for the database, tables - absolutely no effect.

And of course I have <meta http-equiv="content-type" content="text/html; charset=UTF-8"> in <head>

Restarted mysql, mysqld after making changes. But I see absolutely no change and utf-8 characters still appear incorrectly. Utf-8 characters of the old records appear incorrectly in all cases. In the new entries, for example, Spanish characters appear correctly, but Czech, Latvian, etc. characters turn into question marks. But of course I need the old records to display correctly as well.

Please see the image

This is old and new server configuration. As you can see there is only 1 difference - server charset, but as I wrote before, changing it has no effect.

Servers old and new

관련 정보