Database Importing Error: Unknown collation: ‘utf8mb4_0900_ai_ci’ error

*Normally, you will come across this error during database importation.
*The error appears as shown in the image below.

*The error comes as a result of the database (MySQL or Maria DB) versions being different, between the source of the dumb file, and the server where the file is restored.

*In order to solve the error, you need to replace the character set in the database’s dumb file before importing it. You can do so by using the command below, which you will run on your terminal.

First, navigate to the directory where the dumb file is saved then run the command while there, where myfilename.sql is the name of your dumb file.

sed -e ‘s/utf8mb4_0900_ai_ci/utf8mb4_unicode_ci/g’ -i myfilename.sql


E.g if my dumb file is called ourdb.sql, I will run the command as follows;

sed -e ‘s/utf8mb4_0900_ai_ci/utf8mb4_unicode_ci/g’ -i ourdb.sql

Once you are done running the command, import the DB

Below is a link to the video description of this article.

Was this article helpful?

Leave A Comment?