Mysql error ERROR 1273 (HY000) : Unknown collation: ‘utf8mb4_unicode_520_ci’ solved


In my daily tests, i was testing to restore mysql database from debian9 to centos7. its not really cool because the version release of mysql on Debian is higher then Centos,

i did small research and found the solution, and i though maybe its fine to share it with people in this blog.

The Problem:

[root@localhost ~]# mysql -u root -p osradar < osradar.sql
Enter password:
ERROR 1273 (HY000) at line 25: Unknown collation: 'utf8mb4_unicode_520_ci'

Some times you  get this error :

1273 - Unknown collation: 'utf8mb4_unicode_ci'


Please follow the bellow steps:

[root@localhost ~]# sed -i 's/utf8mb4/utf8/g' osradar.sql
[root@localhost ~]# sed -i 's/utf8_unicode_ci/utf8_general_ci/g' osradar.sql
[root@localhost ~]# sed -i 's/utf8_unicode_520_ci/utf8_general_ci/g' osradar.sql

osradar.sql is my MySQL database

Restore the Database now

[root@localhost ~]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 23
Server version: 5.5.56-MariaDB MariaDB Server

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> use osradar;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [osradar]> show tables;
| Tables_in_osradar |
| wp_commentmeta |

Please share your experience with this solution on the comments bellow.

Spread the love
  • 5



Please enter your comment!
Please enter your name here