Unknown collation: ‘utf8mb4_0900_ai_ci’

Recently had an issue importing databases into mysql from a FreeBSD server to a Linux server.

This can easily be fixed by using sed to replace the Collation type.

Linux

sed -e 's/utf8mb4_0900_ai_ci/utf8mb4_unicode_ci/g' -i sqlfile.sql

Mac

sed -i '' 's/utf8mb4_0900_ai_ci/utf8mb4_unicode_ci/g' sqlfile.sql

Then try and reimport the database