The utf8mb4_unicode_ci problem
While restoring a mysql database dump, this error pops up:
ERROR 1273 (HY000) at line ###: Unknown collation: 'utf8mb4_unicode_ci'
ERROR 1115 (42000) at line ###: Unknown character set: 'utf8mb4'
For a clean restore you need to edit the dump you’re about to restore a bit — specifically, replace utf8mb4_unicode_ci with utf8_general_ci.
In bash, it’s convenient to use sed:
sed -i 's/CHARSET=utf8mb4\ COLLATE\=utf8mb4_unicode_ci/CHARSET=utf8\ COLLATE=utf8_general_ci/g' db_name.sql
sed -i 's/COLLATE\ utf8mb4_unicode_ci/COLLATE\ utf8_general_ci/g' db_name.sql
sed -i 's/CHARACTER\ SET\ utf8mb4\ COLLATE\ utf8mb4_bin/CHARACTER\ SET\ utf8\ COLLATE\ utf8_general_ci/g' db_name.sql
After that you can restore the database without worries.