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.

Hit the clap if the article was useful.

1

Share your thoughts !!

Close Menu

Never Miss an article !

Get the new post delivered straight into your inbox, enter your email and hit the button

You have successfully subscribed to the newsletter

There was an error while trying to send your request. Please try again.

codippa will use the information you provide on this form to be in touch with you and to provide updates and marketing.