Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
WordPress found a fatal database error on the Website that looks this way:

COLLATION ‘utf8_general_ci’ is not valid for CHARACTER SET ‘utf8mb4’

Solution:
The reason for this issue is that various database tables use a different collations.

To solve the issue a matching and similar collation for all DB tables.

You can run the following MySQL query to solve such an issue, but it will need to be adjusted with the matching table prefix and also in case a different collation is used than mentioned inside the query:

ALTER TABLE wp_posts CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci;

Relevant Documentation:
https://dev.mysql.com/doc/refman/8.0/en/charset-database.html

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 3 replies, has 2 voices.

Last updated by christopher-3 3 years, 11 months ago.

Assisted by: Bruno Kos.

Author Posts
April 17, 2020 at 8:24 am #5929977

christopher-3

https://wpml.org/forums/topic/fatal-error-collation-utf8_general_ci-is-not-valid-for-character-set-utf8mb4-3/

April 17, 2020 at 9:00 am #5930363

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+01:00)

Hi,

Can I ask you the following? In order to debug this issue, I will install Duplicator plugin, will create packages and will try this on my localhost and possibly escalate further to 2nd tier.

https://wpml.org/faq/provide-supporters-copy-site/

Let me know if this is OK with you.

If yes, I will need WordPress admin username and password so I could do this. I marked your next reply private so you can safely add this information.

https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/

Please make a full backup of your site before sharing this info!

Regards,
Bruno Kos

April 17, 2020 at 10:03 am #5931335

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+01:00)

Hi,

You did not fix it on your site, that's why it isn't working (see the image). Your database is utf8mb4_0900_ai_ci, while all the rows are still in utf8_general_ci, including wp_posts table itself is also utf8_general_ci.

So I followed this and ran these commands on database:
https://wpml.org/forums/topic/fatal-error-collation-utf8_general_ci-is-not-valid-for-character-set-utf8mb4-3/#post-5725825

(make sure to match the table prefix, in your case it is:

ALTER TABLE wp_posts CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci;

And it worked. Make sure to make a full backup of your production site before doing any of these changes there.

Regards,
Bruno Kos

wpml active.jpg
posts.jpg
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.