Issue with utf8mb4_unicode_ci in MySQL dump


Recently I’ve got the following error trying to restore the dump of mysql database:

ERROR 1273 (HY000) at line 175: Unknown collation: ‘utf8mb4_unicode_ci’

In order to restore the backup I had to replace the utf8mb4_unicode_ci with utf8_general_ci in the file.

If you are working in bash than the following will do the trick:

sed -i ‘s/CHARSET=utf8mb4\ COLLATE\=utf8mb4_unicode_ci/CHARSET=utf8\ COLLATE=utf8_general_ci/g’ имя_базы.sql
sed -i ‘s/COLLATE\ utf8mb4_unicode_ci/COLLATE\ utf8_general_ci/g’ имя_базы.sql

The backup was restored after this.

Share Button

Leave a Reply

You must be logged in to post a comment.