Manual converting to utf8mb4 for Matomo-4.x

Hello,
on shared webhosting package access to Sql phpMyAdmin is granted, utf8mb4 is supported by MariaDB, but not activated after updating Matomo-3.14 > 4.1.

According to
https://matomo.org/faq/how-to-update/how-to-convert-the-database-to-utf8mb4-charset/ it is possible to convert to utf8mb4 manually.

To manually convert all Matomo database tables to utf8mb4 follow these steps:
** Execute the following database queries: **
ALTER TABLE piwik_user CONVERT TO CHARACTER SET utf8mb4;
ALTER TABLE piwik_user_token_auth CONVERT TO CHARACTER SET utf8mb4;
ALTER TABLE piwik_twofactor_recovery_code CONVERT TO CHARACTER SET utf8mb4;
ALTER TABLE piwik_access CONVERT TO CHARACTER SET utf8mb4;
ALTER TABLE piwik_site CONVERT TO CHARACTER SET utf8mb4;
ALTER TABLE piwik_plugin_setting CONVERT TO CHARACTER SET utf8mb4;
ALTER TABLE piwik_site_setting CONVERT TO CHARACTER SET utf8mb4;
ALTER TABLE piwik_site_url CONVERT TO CHARACTER SET utf8mb4;
ALTER TABLE piwik_goal CONVERT TO CHARACTER SET utf8mb4;
…a.s.o.

Is it possible to submit all those commands at once (!) in phpMyAdmin/SQL command or must it be done one by one?
phpMyAdmin-SQL

Thanks + best regards!

Hi,

Instead of doing all of this manually, you can also just call ./console core:convert-to-utf8mb4 so that Matomo calls all queries you need automatically and also pauses tracking while they run to avoid issues.

But to answer your question: Yes, as long as they are separated by ; you can call multiple MySQL queries as one big query.

Thanks, but ./console core:convert-to-utf8mb4 is only possible if shell access is granted, shared webpack…
So Sql commands in phpMyAdmin are another option!

Hi,

Just one minor thing: If you manually change things, you will need to add charset = "utf8mb4" in the [database] section of the config afterwards.
And disabling tracking while you are modifying the tables with record_statistics = 0 in the [record_statistics = 1] section might also be a good idea.

If you don’t have shell access, you can also select a option in the Matomo general settings that does the migration in the background.