Drupal Error Unknown collation utf8mb4_0900_ai_ci

mysql-error-unknown-collation

Unknown collation error is a very common problem when working with MySQL databases of a Drupal site. This happens when we try to migrate or restore a Drupal site on a new server. Importing a .sql file often throw this error message.

This is the most common error message that our clients have reported.

#1273 - Unknown collation: 'utf8mb4_0900_ai_ci'

So, how can you resolve this? In this blog post, we will explore the causes of the Unknown collation error and how to fix it.

What is the cause of "Unknown Collation" error

The Unknown collation error occurs when MySQL encounters a collation that it doesn't recognize, or that is incompatible with the version of MySQL you are using. This typically happens under the following conditions:

  • Different MySQL Version: When the old and new server have different MySQL version or MySQL engine.

How to fix "Unknown Collation" error

Please follow below steps to fix this error message.

  • Open .sql file in any text editor like notepad++
  • Find and replace all utf8mb4_0900_ai_ci with utf8mb4_general_ci
  • Save the .sql file.

Now try to upload / import .sql file on a fresh / clean mysql database. Most people use phpmyadmin to export and import database.

Category: