Problem of db encoding!

Hi

I’m trying to migrate Matomo to a new server but I have an issue with the db. Matomo on new host complains about that:

## **SQLSTATE[HY000] [2019] Unknown character set**

I have tried using PHPMyAdim to change the character set of tables and columns and updating config file in same time but it still keeps giving that error message. I have tried utf8_unicode_ci, utf8_general_ci and same with utf8mb4 but still same error :frowning:
New server is running MariaDB 10.4 and PHP 8.2

Thankr for help,

Vincèn

No one on that ?

Thanks

did you try reinstalling MariaDB through SSH?

I had something similar, not same error, but had to update MariaDB.
Did a cleaner install, cleared cached too.

Hi,

MariaDB is working perfectly fine (it’s on a shared hosting server).
I found the solution by using differenc character set for data and collations:

charset = "utf8"
collation = "utf8_unicode_ci"

Edit: it worked few minutes and now it makes a new error, just a nightmare to fix that thing :frowning:
## **SQLSTATE[42000] [1253] COLLATION 'utf8_unicode_ci' is not valid for CHARACTER SET 'utf8mb4'**

Vincèn

I think your issue might be with the Shared Hosting.

The collation utf8_unicode_ci is valid only for the utf8 character set, not for utf8mb4, which is often the default in modern MariaDB/MySQL installations.

On shared hosting servers you may not have access to the configuration files (i.e.my.cnf) to globally set the character set and collation. Instead, you’ll need to explicitly set the character set and collation in your database, tables, or connection code.

I’d reach out to the hosting support regarding this.

I’ve never seen this error and I use only private VPSs, my own ones or for clients.

PS: What you can do to check what I said above is to run the following SQL query to check the server defaults:

SHOW VARIABLES LIKE 'character_set%';
SHOW VARIABLES LIKE 'collation%';

This will show the default character set and collation for the server. If the default is utf8mb4, you’ll need to adjust your configuration to match.

PPS: I’ve found myself personally tweaking things with MariaDB and getting it to work smoother with lots of back and forth terminal commands, taking notes etc. I suggest you try, reach out to support and let us know how you go.