MySQL Import error - Unknown collation: 'utf8mb4_unicode_520ci_'

15.4k views Asked by At
4

There are 4 answers

0
Alexei - check Codidact On

You should change collation utf8mb4_unicode_ci to utf8_general_ci. One way to do this is provided here.

You can also edit the sql file and replace ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci with ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci

0
One Mad Geek On

Before editing .sql file. Have a look at the version between both(backup and restore) of your MySQL. It was a version issue in my case. If you manage to get it on the same version, it solves the issue in most cases. If not then go for other recommended ways.

0
Susil Parida On

You need to replace charset "utf8mb4" with "utf8" and COLLATE "utf8mb4_unicode_520ci" in your case with "utf8_general_ci".

You can achieve the replacement in MAC with below sed command. In Linux remove ''.

sed -i '' s/utf8mb4_unicode_520ci/utf8_general_ci/g NEW-CLEANED-DUMP.sql

sed -i '' s/utf8mb4/utf8/g NEW-CLEANED-DUMP.sql

0
Hasanin Alsabounchi On

open .sql file and rome

INGINE=InnoDB AUTO_INCREMENT=8193 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

manually and it will work