4 C
Texas
Mel K
LInux Guru and Technical Writer

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 :

- Advertisement -
1273 - Unknown collation: 'utf8mb4_unicode_ci'

Solution:

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.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article