(Resolved) Unknown collation: utf8mb4_0900_ai_ci

 

(Resolved) Unknown collation: utf8mb4_0900_ai_ci


A collation is a set of rules that defines how to compare and sort character strings in a database server. In this tutorial, we are discussing an error faced during database restoration on another server.


To get latest videos on such issues click on below link and subscribe the Youtube channel.Thank You..!!

https://www.youtube.com/channel/UCMTJnNFqSYzlJsp0Tzu9BDA

Problem

During the migration of a web application, I got the below error while restoring a database on another server. The collation id may differ based on the MySQL version.


Error message:


Error 1273 (HY000) at line 25 Unknown collation: 'utf8mb4_0900_ai_ci'






Here you go with a solution.


Solution

After a little investigation, I found that the MySQL server running on the destination is an older version than the source. So we got that the destination server doesn’t contain the required database collation.


Then we do a little tweak in the backup file to resolve this. Edit the database backup file in text editor and replace utf8mb4_0900_ai_ci with utf8mb4_general_ci and CHARSET=utf8mb4 with CHARSET=utf8.


Replace the below string:


ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;


with:


ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;



Save your file and restore the database.





Comments

Popular posts from this blog

Angular Best Practices and Coding Standards: A Guide for Developers

How to SSH AWS EC2 instance?

Top 7 ways to use Interceptors in Angular