Sometimes when importing a database dump from another MySQL server or executing an SQL query that uses a collation, you might encounter Unknown collation errors something like below
ERROR 1273 Unknown collation: ‘utf8mb4_0900_ai_ci’
ERROR 1273 Unknown collation: ‘utf8mb4_unicode_520_ci’
ERROR 1273 Unknown collation: ‘utf8mb4_unicode_ci’
Solution
Quickest solution to resolve this error is to replace the collation value in SQL query with below
utf8mb4_general_ci
If this does not work, then change the encoding from utfmb4
to utf8
as below
utf8_general_ci
If you are using an SQL dump file, then open it with a text editor and replace all occurrences of utf8mb4_0900_ai_ci
with utf8mb4_general_ci
.
Reason
Main reason that this error occurs is due to version mismatch between MySQL server from which the dump was exported and on which it is imported.
Older versions of MySQL do not support utf8mb4
encoding and you are using it, this is another reason that raises the error.
Wow! After all I got a weeb site from where I can inn fact obtain useful
ddata concerning my study and knowledge.